using slnmesnac.rfidupload.Repository; using SlnMesnac.RfidUpload.Business; using SlnMesnac.RfidUpload.Common; using SlnMesnac.RfidUpload.Model.apiParam; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SlnMesnac.RfidUpload.UI { public class Tool { private static SqlSugarHelper sqliteHelper = SqlSugarHelper.Instance; public static void Push(List strList, Dbt dtDbt, Action action) { string opBatch = dtDbt.opBatch; CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance; int batchNo = 0; ListPage ls = new ListPage(strList, 500); CsbResult res = new CsbResult(); foreach (var enumerable in ls.GetPage()) { batchNo++; res = csbHandleBusiness.containerScanSealByCsb(dtDbt.ffjhNo, opBatch, dtDbt.ffjhscrq, batchNo.ToString(), enumerable.ToList()); action.Invoke(0,res.GetMsg()); } // MainPageTipMessage = $"封发-按调拨单 [{res.GetMsg()}]"; if (res.IsSuccess) { Task.Run(() => { // 五、6.10反馈接收结果(利用上一步的opBatch) Task.Delay(2000); CsbResult res1 = csbHandleBusiness.containerScanSealResultByCsb(dtDbt.ffjhNo, opBatch); action.Invoke(1,res1.GetMsg()); if (!res1.IsSuccess) return; //六、6.12 效验发运计划(利用上一步的opBatch) string stationOrgCode = dtDbt != null ? dtDbt.stationOrgCode : ""; string stationOrgName = dtDbt != null ? dtDbt.stationOrgName : ""; CsbResult res2 = csbHandleBusiness.tranPlanCheckByCsb(dtDbt.ffjhNo, opBatch, stationOrgCode, stationOrgName); action.Invoke(2,res2.GetMsg()); if (res2.IsSuccess) { // 七、6.13.容器直连配发-开始配发 CsbResult res3 = csbHandleBusiness.containerAllotByCsb(dtDbt.ffjhNo, opBatch); action.Invoke(3,res3.GetMsg()); if (res3.IsSuccess) { Task.Delay(3000); //八、反馈接收接口,确认是否和实际相符 for (int i = 0; i < 3; i++) { try { CsbResult res4 = csbHandleBusiness.containerAllotResultByCsb(dtDbt.ffjhNo, opBatch); action.Invoke(4,res4.GetMsg()); if (res4.IsSuccess) { sqliteHelper.updateRecordByFfjhNo(dtDbt.ffjhNo, true); break; }; } catch (Exception ex) { Task.Delay(3000); } } } } }); } } } public class Dbt { public string opBatch { get; set; } public string ffjhNo { get; set; } public string ffjhscrq { get; set; } public string No { get; set; } public string stationOrgCode { get; set; } public string stationOrgName { get; set; } } }