public void DownOrder() { var random = new Random(); string flow = DateTime.Now.ToString("MMddHHmmss"); var wave = new WaveApi() { LastTime = DateTime.Now, Status = 0, WaveNo = flow + "waveNo", OrderApi = new List <OrderApi>() }; for (int i = 1; i <= 1; i++) { wave.OrderApi.Add(new OrderApi { OrderNo = flow + "orderNo" + i, Status = OrderStatus.Normal, ProductApi = new List <ProductApi> { new ProductApi { Num = random.Next(1, 3), ProductCode = "0727085908orderNo" + random.Next(1, 50), ProductName = "ProductName" } } }); } bool ifds = WaveApiService.AddOrUpdate(wave); }
/// <summary> /// 初始化服务 /// </summary> private void InitService() { SlaveInfoService = new SlaveInfoService(); ButtonService = new ButtonService(SlaveInfoService); SysConfig = new SysConfigService().Get(); WaveApiService = new WaveApiService(); UpDownService = new UpDownService(SysConfig, SlaveInfoService, Main.CurUser); UpDownService.AddService(new PcUpDownService(SlaveInfoService, ButtonService, SynchronizationContext.Current, SysConfig, Main.CurUser)); UpDownService.AddService(new BoardUpDownService(SlaveInfoService)); }
/// <summary> /// 开始波次 /// </summary> /// <param name="waveNo"></param> private void SortWaveBegin(string waveNo) { if (!string.IsNullOrWhiteSpace(SlaveInfoService.SlaveInfo.WaveNo) && !SlaveInfoService.SlaveInfo.IsPrintOver) { SoundService.PlaySoundAsny(SoundType.WatitPrintOver); UpDownService.SetText("请等待打印完毕!"); return; } var waveApi = WaveApiService.Get(waveNo); if (waveApi == null) { UpDownService.WaveNotfound(waveNo); Invoke((MethodInvoker) delegate() { lblMsg.Text = $"未找到波次:{waveNo}"; }); return; } if (waveApi.Status == WaveStatus.Complete) { //var result = MessageBox.Show($"波次:{waveNo}已分拣完,是否重新分拣?", "提示", // MessageBoxButtons.OKCancel); //if (result == DialogResult.OK) //{ var slaveInfo = SlaveInfoService.GetSlaveInfo(o => o.WaveNo == waveNo); SlaveInfoService.DeleteSlaveInfo(slaveInfo); slaveInfo = WaveApiService.WaveApiTransformSlaveInfo(waveApi); UpDownService.BeginSort(slaveInfo); Invoke((MethodInvoker) delegate() { lblMsg.Text = $"开始波次:{waveNo}"; }); //} return; } if (waveApi.Status == WaveStatus.Unwork) { var slaveInfo = WaveApiService.WaveApiTransformSlaveInfo(waveApi); if (slaveInfo != null) { UpDownService.BeginSort(slaveInfo); Invoke((MethodInvoker) delegate() { lblMsg.Text = $"开始波次:{waveNo}"; }); } } }
public void DownWave(string domainName, string Processcenterid) { if (string.IsNullOrWhiteSpace(domainName) || string.IsNullOrWhiteSpace(Processcenterid)) { return; } DateTime DateS = WaveApiService.GetLastTime(); DateTime DateE = DateTime.Now; var data = OrderAPI.GetWaveAPI(domainName, Processcenterid, DateS, DateE); if (data != null) { WaveApiService.UpdateWaveApi(data); } }
/// <summary> /// 开始分拣产品 /// </summary> /// <param name="productCode"></param> private void SortProductBegin(string barCode) { //0.验证 if (SlaveInfoService.SlaveInfo.LatticeStatus == LatticeStatus.PutError) { if (SlaveInfoService.LatticeInfoList.Exists(o => o.Status == LatticeStatus.WaitPut && o.Product.Exists(p => p.BarCode == barCode))) { var latticePutError = SlaveInfoService.LatticeInfoList.Where(o => o.Status == LatticeStatus.PutError).ToList(); UpDownService.RemovePutError(new UpDownMessage() { LatticeByUpDown = latticePutError.Select(l => new LatticeByUpDown { LatticeNo = l.LatticeNo }).ToList() }); lblMsg.Text = string.Format(Resources.RemovePutError, barCode); } else { lblMsg.Text = string.Format(Resources.PleaseSolvePutError, barCode); SoundService.PlaySound(SoundType.PutError); } return; } if (SlaveInfoService.SlaveInfo.LatticeStatus == LatticeStatus.BlockError) { lblMsg.Text = string.Format(Resources.PleaseSolveBlockError, barCode); SoundService.PlaySound(SoundType.BlockError); return; } if (SlaveInfoService.SlaveInfo.LatticeStatus == LatticeStatus.WaitPut) { lblMsg.Text = string.Format(Resources.PleaseWait, barCode); UpDownService.SetText("存在待投递的产品!"); SoundService.PlaySoundAsny(SoundType.WaitPut); return; } //1.装载格口 var waveApiList = WaveApiService.GetOrderApiList(SlaveInfoService.SlaveInfo.WaveNo, barCode); if (waveApiList.Count == 0) { UpDownService.ProductNotFound(); lblMsg.Text = string.Format(Resources.ProductError, SlaveInfoService.SlaveInfo.WaveNo, barCode); return; } waveApiList.ForEach(o => { if (!SlaveInfoService.LatticeInfoList.Exists(s => s.OrderNo == o.OrderNo)) { SlaveInfoService.LoadLattice(o); } }); if (!SlaveInfoService.SlaveInfo.LatticeInfo.SelectMany(o => o.Product).Where(o => o.BarCode == barCode).Any(o => !o.IsComplete)) { lblMsg.Text = $"货物已配足:{barCode}"; UpDownService.SetText($"货物已配足:{barCode}"); SoundService.PlaySoundAsny(SoundType.ProductOver); return; } //2.更新格口为待投递 string orderNo = waveApiList.First().OrderNo; var waitPutLattice = SlaveInfoService.LatticeInfoList.Where(o => !o.IsComplete && waveApiList.Select(s => s.OrderNo).Contains(o.OrderNo)).ToList(); UpDownService.WaitPut(waitPutLattice, barCode); }
public frmWaveApiSync(SysConfig SysConfig) { InitializeComponent(); WaveApiService = new WaveApiService(); this.SysConfig = SysConfig; }
public OrderDownloadTask() { WaveApiService = new WaveApiService(); OrderAPI = new OrderAPI(); }