schangxiang@126.com
2025-04-01 de7dbe7cf85aa01abb64040aae1c04dfba74c135
CC/iWareCC_ASRS/ThreadService/02_BZ39¹¤Î»£¨²¹°åºó¹¤Î»£©/Inbound/2¡¢DataProcess_BZ39_IssueInboundTask.cs
@@ -67,28 +67,57 @@
                            //这里下发 å…¥åº“库任务
                            using (StationServiceClient client = new StationServiceClient())
                            {
                            ////这里下发 å…¥åº“库任务
                            //using (StationServiceClient client = new StationServiceClient())
                            //{
                                var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode,
                                   (short)doTask.Length,
                                   (short)doTask.Width, (short)doTask.Thk, Convert.ToInt32(doTask.TaskNo));
                                if (!res.result)
                                {
                                    SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-下发入库任务 å¤±è´¥,WriteInStoreTaskInfoAsync è¿”回:{res.resMsg}";
                                    continue;
                                }
                                else
                                {
                                    Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-下发入库任务 æˆåŠŸ,WriteInStoreTaskInfoAsync,参数: ç«™ç‚¹{rgvLocation}");
                                }
                            }
                            //    var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode,
                            //       (short)doTask.Length,
                            //       (short)doTask.Width, (short)doTask.Thk, Convert.ToInt32(doTask.TaskNo));
                            //    if (!res.result)
                            //    {
                            //        SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-下发入库任务 å¤±è´¥,WriteInStoreTaskInfoAsync è¿”回:{res.resMsg}";
                            //        Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-下发PLC入库任务失败 ,WriteInStoreTaskInfoAsync,返回:{res.resMsg},参数: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo}", null);
                            //        continue;
                            //    }
                            //    else
                            //    {
                            //        Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-下发PLC入库任务 æˆåŠŸ,WriteInStoreTaskInfoAsync,参数: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo}");
                            //    }
                            //}
                            doTask.TaskStatus = (int)TaskStatusEnum.已下发;
                            doTask.IssueTime = DateTime.Now;
                            wmsDB.SaveChanges();
                            int changeNum = wmsDB.SaveChanges();
                            if (changeNum > 0)
                            {
                                //必须要给PLC下发成功,解决可能会给PLC重复下发任务的情况
                                var isRight = true;
                                while (isRight)
                                {
                                    //这里下发 å…¥åº“库任务
                                    using (StationServiceClient client = new StationServiceClient())
                                    {
                                        var res = await client.WriteInStoreTaskInfoAsync((int)EDevice.Station, rgvLocation, doTask.PlaceCode,
                                           (short)doTask.Length,
                                           (short)doTask.Width, (short)doTask.Thk, Convert.ToInt32(doTask.TaskNo));
                                        if (!res.result)
                                        {
                                            SystemWarningMsg._lbl_alert_DataProcess_BZ39 = $"{rgvLocation.ToString()}-下发入库任务 å¤±è´¥,WriteInStoreTaskInfoAsync è¿”回:{res.resMsg}";
                                            Log4NetHelper.WriteErrorLog(logType, $"{rgvLocation.ToString()}-下发PLC入库任务失败 ,WriteInStoreTaskInfoAsync,返回:{res.resMsg},参数: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},条码:{doTask.Upi}", null);
                                            continue;
                                        }
                                        else
                                        {
                                            Log4NetHelper.WriteInfoLog(logType, $"{rgvLocation.ToString()}-下发PLC入库任务 æˆåŠŸ,WriteInStoreTaskInfoAsync,参数: PlaceCode:{doTask.PlaceCode},TaskNo:{doTask.TaskNo},条码:{doTask.Upi}");
                                            isRight = false;
                                        }
                                    }
                                    Thread.Sleep(1000);
                                }
                            }
                        }
                    }