/// <summary> /// 进行重定向 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RedirectBtn_Click(object sender, RoutedEventArgs e) { if (!int.TryParse(taskId.Text, out int taskid)) { Notice.Show("任务ID必须是整型数字", "错误", 3, MessageBoxIcon.Error); return; } int orderint = -1; if (order.Text != "" && !int.TryParse(order.Text, out orderint)) { Notice.Show("Order必须是数字", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否进行[重定向任务]!!")) { return; } if (!ADS.mNDCControl.DoReDerect(taskid, redirectArea.Text, out string result, orderint)) { Notice.Show(result, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 放货 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UnloadBtn_Click(object sender, RoutedEventArgs e) { string dev = ""; byte[] order = null; try { if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } if (string.IsNullOrEmpty(xlocation.Text.Trim()) || string.IsNullOrEmpty(ylocation.Text.Trim()) || string.IsNullOrEmpty(zlocation.Text.Trim())) { Notice.Show("请填写目的坐标!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; ABC abc = new ABC(dev); if (abc.ActionStatus() == ABC.Run) { Notice.Show("指令发送失败:设备运行中!", "错误", 3, MessageBoxIcon.Error); return; } if (abc.DeviceStatus() == ABC.DeviceError) { Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否进行[放货任务]!!")) { return; } int x = Convert.ToInt32(xlocation.Text.Trim()); int y = Convert.ToInt32(ylocation.Text.Trim()); int z = Convert.ToInt32(zlocation.Text.Trim()); order = ABC._TaskControl(ABC.TaskRelease, abc.ABCNum(), DataControl._mStools.IntToBytes(x), DataControl._mStools.IntToBytes(y), DataControl._mStools.IntToBytes(z)); DataControl._mSocket.SwithRefresh(dev, false); if (!DataControl._mSocket.SendToClient(dev, order, out string result)) { DataControl._mSocket.SwithRefresh(dev, true); Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("UnloadBtn_Click()", "行车-放货任务[ABC,指令]", dev, DataControl._mStools.BytetToString(order), result.ToString()); return; } Notice.Show("放货任务 指令发送成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("UnloadBtn_Click()", "行车-放货任务[ABC,指令]", dev, DataControl._mStools.BytetToString(order), ex.Message); } }
/// <summary> /// 卸货 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UnloadAgvBtn_Click(object sender, RoutedEventArgs e) { if (!int.TryParse(taskId.Text, out int taskid)) { Notice.Show("任务ID必须是数字", "错误", 3, MessageBoxIcon.Error); return; } //if (!int.TryParse(agvName.Text, out int agvid)) //{ // Notice.Show("AGVID必须是整型数字", "错误", 3, MessageBoxIcon.Error); // return; //} if (!WindowCommon.ConfirmAction("是否进行[卸货任务]!!")) { return; } //if (!ADS.mNDCControl.DoUnLoad(taskid, agvid, out string result)) if (!ADS.mNDCControl.DoUnLoad(taskid, out string result)) { Notice.Show(result, "错误", 3, MessageBoxIcon.Error); } }
private void BtnSave_Click(object sender, RoutedEventArgs e) { try { if (PublicParam.IsDoTask) { Notice.Show("请先关闭顶部[设备运作]!", "提示", 3, MessageBoxIcon.Info); return; } string awcX = TBawcX.Text; string awcYt = TBawcYt.Text; string awcZt = TBawcZt.Text; string awcYs = TBawcYs.Text; string awcZs = TBawcZs.Text; string rgv1 = TBrgv1.Text; string rgv2 = TBrgv2.Text; if (string.IsNullOrEmpty(awcX) || string.IsNullOrEmpty(awcYt) || string.IsNullOrEmpty(awcZt) || string.IsNullOrEmpty(awcYs) || string.IsNullOrEmpty(awcZs) || string.IsNullOrEmpty(rgv1) || string.IsNullOrEmpty(rgv2)) { Notice.Show("请完整填空!", "提示", 3, MessageBoxIcon.Info); return; } if (!WindowCommon.ConfirmAction("是否保存修改数据!!")) { return; } CommonSQL.UpdateWcsLoc(wmsloc, rgv1, rgv2, string.Format("{0}-{1}-{2}", awcX, awcYt, awcZt), string.Format("{0}-{1}-{2}", awcX, awcYs, awcZs)); ADS.mAwc.ClearLoc(wmsloc); if (wmsloc.Last() == '1') { wmsloc = wmsloc.Remove(wmsloc.Length - 1, 1) + "2"; awcZs = (int.Parse(awcZs) + high).ToString(); CommonSQL.UpdateWcsLoc(wmsloc, rgv1, rgv2, string.Format("{0}-{1}-{2}", awcX, awcYt, awcZt), string.Format("{0}-{1}-{2}", awcX, awcYs, awcZs)); ADS.mAwc.ClearLoc(wmsloc); } BtnSave.IsEnabled = false; wmsloc = ""; Notice.Show("保存修改成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 定位任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LocateBtn_Click(object sender, RoutedEventArgs e) { string dev = ""; byte[] order = null; try { if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } if (string.IsNullOrEmpty(location.Text.Trim())) { Notice.Show("请填写目的坐标!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; ARF arf = new ARF(dev); if (arf.ActionStatus() == ARF.Run) { Notice.Show("指令发送失败:设备运行中!", "错误", 3, MessageBoxIcon.Error); return; } if (arf.DeviceStatus() == ARF.DeviceError) { Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否发送定位指令!!")) { return; } int loc = Convert.ToInt32(location.Text.Trim()); order = ARF._Position(arf.ARFNum(), (byte)loc); DataControl._mSocket.SwithRefresh(dev, false); if (!DataControl._mSocket.SendToClient(dev, order, out string result)) { DataControl._mSocket.SwithRefresh(dev, true); Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("LocateBtn_Click()", "摆渡车-定位任务[ARF,指令]", dev, DataControl._mStools.BytetToString(order), result.ToString()); return; } Notice.Show("定位任务 指令发送成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("LocateBtn_Click()", "摆渡车-定位任务[ARF,指令]", dev, DataControl._mStools.BytetToString(order), ex.Message); } }
private void FIN_Click(object sender, RoutedEventArgs e) { try { if (DGtask.SelectedItem == null) { return; } if (!WindowCommon.ConfirmAction("是否确认完成任务!!")) { return; } string id = (DGtask.SelectedItem as DataRowView)["任务号"].ToString(); string f = (DGtask.SelectedItem as DataRowView)["来源"].ToString(); string t = (DGtask.SelectedItem as DataRowView)["目的"].ToString(); string type = (DGtask.SelectedItem as DataRowView)["任务类型"].ToString(); // 完成任务 string mes = null; switch (type) { case "入库": mes = ADS.mHttp.DoStockInFinishTask(t, id); break; case "出库": mes = ADS.mHttp.DoStockOutFinishTask(f, id); break; default: break; } if (mes.Contains("OK")) { CommonSQL.UpdateWms(id, (int)WmsTaskStatus.完成); Notice.Show("成功!", "完成", 3, MessageBoxIcon.Success); } else { Notice.Show(mes, "失败", 3, MessageBoxIcon.Warning); } Refresh_Click(sender, e); } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
private void Cancel_Click(object sender, RoutedEventArgs e) { try { if (DGtask.SelectedItem == null) { return; } if (!WindowCommon.ConfirmAction("是否确认删除任务!!")) { return; } string id = (DGtask.SelectedItem as DataRowView)["任务号"].ToString(); string type = (DGtask.SelectedItem as DataRowView)["任务类型"].ToString(); // 取消任务 string mes = null; switch (type) { case "入库": Notice.Show("入库任务不允许撤销!", "提示", 3, MessageBoxIcon.Info); return; //mes = ADS.mHttp.DoCancelTask(WmsStatus.StockInTask, id); //break; case "出库": // 行车判断 if (ADS.mAwc.IsCanDelOut(id)) { mes = ADS.mHttp.DoCancelTask(WmsStatus.StockOutTask, id); } break; default: break; } CommonSQL.DeleteWms(id); Notice.Show("成功!", "删除任务", 3, MessageBoxIcon.Success); Refresh_Click(sender, e); } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 定位任务 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LocateBtn_Click(object sender, RoutedEventArgs e) { string dev = ""; try { if (PublicParam.IsDoTask) { Notice.Show("请先关闭顶部[设备运作]!", "提示", 3, MessageBoxIcon.Info); return; } if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } if (string.IsNullOrEmpty(location.Text.Trim())) { Notice.Show("请填写目的坐标!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; if (!ADS.mSocket.IsConnected(dev)) { Notice.Show(dev + "已离线,无法操作!", "提示", 3, MessageBoxIcon.Info); return; } if (!WindowCommon.ConfirmAction("是否发送定位指令!!")) { return; } int loc = Convert.ToInt32(location.Text.Trim()); ADS.mArf.devices.Find(c => c.devName == dev).ToSite(loc); Notice.Show("定位任务 指令发送成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG CommonSQL.LogErr("LocateBtn_Click()", "摆渡车界面定位[设备号]", ex.Message, dev); } }
private void AddTaskBtn_Click(object sender, RoutedEventArgs e) { if (!int.TryParse(taskId.Text, out int taskid)) { Notice.Show("任务ID必须是整型数字", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否请求[AGV任务]!!")) { return; } if (!ADS.mNDCControl.AddNDCTask(taskid, loadSite.Text, unloadSite.Text, out string result)) { Notice.Show(result, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 启动辊台 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BTNrun_Click(object sender, EventArgs e) { string dev = ""; try { if (PublicParam.IsDoTask) { Notice.Show("请先关闭顶部[设备运作]!", "提示", 3, MessageBoxIcon.Info); return; } if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; if (!ADS.mSocket.IsConnected(dev)) { Notice.Show(dev + "已离线,无法操作!", "提示", 3, MessageBoxIcon.Info); return; } if (!WindowCommon.ConfirmAction("是否发送滚筒启动指令!!")) { return; } ADS.mArf.devices.Find(c => c.devName == dev).ControlRoller( Convert.ToInt32(CBsite1.Text.Substring(0, 1)), Convert.ToInt32(CBsite2.Text.Substring(0, 1)), Convert.ToInt32(CBsite3.Text.Substring(0, 1)), Convert.ToInt32(CBsite4.Text.Substring(0, 1))); Notice.Show("启动辊台 指令发送成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG CommonSQL.LogErr("BTNrun_Click()", "摆渡车界面启动辊台[设备号]", ex.Message, dev); } }
private void deleteorder_Click(object sender, RoutedEventArgs e) { int i = -1; if (index.Text != "" && !int.TryParse(index.Text, out i)) { Notice.Show("Index必须是数字", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("确定需要[取消任务]!!")) { return; } if (!ADS.mNDCControl.DoCancelIndex(i, out string result)) { Notice.Show(result, "错误", 3, MessageBoxIcon.Error); } }
private void GetBin_Click(object sender, RoutedEventArgs e) { try { if (DGtask.SelectedItem == null) { return; } if (!WindowCommon.ConfirmAction("是否请求库位分配!!")) { return; } string id = (DGtask.SelectedItem as DataRowView)["任务号"].ToString(); string status = (DGtask.SelectedItem as DataRowView)["任务状态"].ToString(); string type = (DGtask.SelectedItem as DataRowView)["任务类型"].ToString(); if (type == "入库") { // 请求WMS入库分配 if (ADS.AssignInSite("B01", id)) { Notice.Show("完成!请刷新~", "分配", 3, MessageBoxIcon.Success); } else { Notice.Show("失败!", "失败", 3, MessageBoxIcon.Warning); } } else { Notice.Show("该任务不符合分配条件!", "提示", 3, MessageBoxIcon.Info); } Refresh_Click(sender, e); } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
private void BTNrun_Click(object sender, RoutedEventArgs e) { string dev = ""; try { if (PublicParam.IsDoTask) { Notice.Show("请先关闭顶部[设备运作]!", "提示", 3, MessageBoxIcon.Info); return; } if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; if (!ADS.mSocket.IsConnected(dev)) { Notice.Show(dev + "已离线,无法操作!", "提示", 3, MessageBoxIcon.Info); return; } if (!WindowCommon.ConfirmAction("是否发送辊台指令!!")) { return; } ADS.mPkl.devices.Find(c => c.devName == dev).StartGiveRoll(); Notice.Show("启动辊台 指令发送成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG CommonSQL.LogErr("BTNrun_Click()", "包装线界面启动辊台[设备号]", ex.Message, dev); } }
/// <summary> /// 分配卸货 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnFRT_Click(object sender, RoutedEventArgs e) { try { string frtP = CBfrt_P.Text.Trim(); string code = TBcode.Text.Trim(); string frtD = CBfrt_D.Text.Trim(); if (string.IsNullOrEmpty(frtP) || string.IsNullOrEmpty(code)) { Notice.Show("包装线辊台设备号 / 货物条码 不能为空!", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否进行[获取入库区域任务]!!")) { return; } if ((bool)CheckWMS.IsChecked) { if (string.IsNullOrEmpty(frtD)) { Notice.Show("卸货点不能为空!", "错误", 3, MessageBoxIcon.Error); return; } // 获取Task资讯 String sql = String.Format(@"select * from wcs_task_info where SITE <> '{1}' and BARCODE = '{0}'", code, TaskSite.完成); DataTable dt = DataControl._mMySql.SelectAll(sql); if (!DataControl._mStools.IsNoData(dt)) { Notice.Show("货物条码已存在任务!", "提示", 3, MessageBoxIcon.Info); return; } // 无Task资讯则新增 // 呼叫WMS 请求入库资讯---区域 WmsModel wms = new WmsModel() { Task_UID = "NW" + System.DateTime.Now.ToString("yyMMddHHmmss"), Task_type = WmsStatus.StockInTask, Barcode = code, W_S_Loc = DataControl._mTaskTools.GetArea(frtP), W_D_Loc = DataControl._mTaskTools.GetArea(frtD) }; // 写入数据库 if (new ForWMSControl().WriteTaskToWCS(wms, out string result)) { Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success); } else { Notice.Show("失败:" + result, "错误", 3, MessageBoxIcon.Error); } } else { if (new ForWMSControl().ScanCodeTask_P(frtP, code)) { Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success); } else { Notice.Show("失败!", "错误", 3, MessageBoxIcon.Error); } } } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 分配货位 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnLOC_Click(object sender, RoutedEventArgs e) { try { string frtP = CBfrt_P.Text.Trim(); string code = TBcode.Text.Trim(); string frtD = CBfrt_D.Text.Trim(); if (string.IsNullOrEmpty(frtP) || string.IsNullOrEmpty(code)) { Notice.Show("包装线辊台设备号 / 货物条码 不能为空!", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否进行[获取入库坐标任务]!!")) { return; } if ((bool)CheckWMS.IsChecked) { if (string.IsNullOrEmpty(frtD)) { Notice.Show("卸货点不能为空!", "错误", 3, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(TBlocX.Text.Trim()) && string.IsNullOrEmpty(TBlocY.Text.Trim()) && string.IsNullOrEmpty(TBlocZ.Text.Trim())) { Notice.Show("货位不能为空!", "错误", 3, MessageBoxIcon.Error); return; } // 货位 string LOC = "C" + TBlocX.Text.Trim().PadLeft(3, '0') + "-" + TBlocY.Text.Trim().PadLeft(2, '0') + "-" + TBlocZ.Text.Trim().PadLeft(2, '0'); // 获取Task资讯 String sql = String.Format(@"select TASK_UID from wcs_task_info where TASK_TYPE = '{1}' and BARCODE = '{0}'", code, TaskType.入库); DataTable dt = DataControl._mMySql.SelectAll(sql); if (DataControl._mStools.IsNoData(dt)) { Notice.Show("不存在任务Task资讯!", "错误", 3, MessageBoxIcon.Error); return; } // 获取对应任务ID string taskuid = dt.Rows[0]["TASK_UID"].ToString(); // 更新任务资讯 sql = String.Format(@"update WCS_TASK_INFO set UPDATE_TIME = NOW(), TASK_TYPE = '{0}', W_S_LOC = '{1}', W_D_LOC = '{2}' where TASK_UID = '{3}'", TaskType.入库, DataControl._mTaskTools.GetArea(frtD), LOC, taskuid); DataControl._mMySql.ExcuteSql(sql); // 对应 WCS 清单 DataControl._mTaskTools.CreateCommandIn(taskuid, frtD); Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success); } else { if (new ForWMSControl().ScanCodeTask_Loc(frtP, code)) { Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success); } else { Notice.Show("失败!", "错误", 3, MessageBoxIcon.Error); } } } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 启动辊台 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BTNrun_Click(object sender, EventArgs e) { string dev = ""; byte[] order = null; try { if (CBdev.SelectedIndex == -1) { Notice.Show("请选择设备!", "提示", 3, MessageBoxIcon.Info); return; } dev = CBdev.Text; FRT frt = new FRT(dev); if (frt.ActionStatus() == FRT.Run) { Notice.Show("指令发送失败:设备运行中!", "错误", 3, MessageBoxIcon.Error); return; } if (frt.DeviceStatus() == FRT.DeviceError) { Notice.Show("指令发送失败:设备故障!", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否进行[滚筒启动任务]!!")) { return; } // 方式 byte site1 = FRT.RollerRun1; if (CBsite1.SelectedValue.ToString() == "启动2#辊台") { site1 = FRT.RollerRun2; } if (CBsite1.SelectedValue.ToString() == "启动全部辊台") { site1 = FRT.RollerRunAll; } // 方向 byte site2 = FRT.RunFront; if (CBsite2.SelectedValue.ToString() == "反向启动") { site2 = FRT.RunObverse; } // 类型 byte site3 = FRT.GoodsReceive; if (CBsite3.SelectedValue.ToString() == "送货") { site3 = FRT.GoodsDeliver; } // 数量 byte site4 = FRT.GoodsQty1; if (CBsite4.SelectedValue.ToString() == "货物数量2") { site4 = FRT.GoodsQty2; } order = FRT._RollerControl(frt.FRTNum(), site1, site2, site3, site4); DataControl._mSocket.SwithRefresh(dev, false); if (!DataControl._mSocket.SendToClient(dev, order, out string result)) { DataControl._mSocket.SwithRefresh(dev, true); Notice.Show("指令发送失败:" + result.ToString(), "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("BTNrun_Click()", "固定辊台-启动辊台任务[FRT,指令]", dev, DataControl._mStools.BytetToString(order), result.ToString()); return; } Notice.Show("启动辊台 指令发送成功!", "成功", 3, MessageBoxIcon.Success); } catch (Exception ex) { Notice.Show("指令发送失败:" + ex.Message, "错误", 3, MessageBoxIcon.Error); // LOG DataControl._mTaskTools.RecordTaskErrLog("BTNrun_Click()", "固定辊台-启动辊台任务[FRT,指令]", dev, DataControl._mStools.BytetToString(order), ex.Message); } }
/// <summary> /// 货位出库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnOUT_Click(object sender, RoutedEventArgs e) { // 无用资讯 CBfrt_P.Text = ""; TBcode.Text = ""; string frtD = CBfrt_D.Text.Trim(); if (string.IsNullOrEmpty(frtD)) { Notice.Show("卸货点不能为空!", "错误", 3, MessageBoxIcon.Error); return; } if (string.IsNullOrEmpty(TBlocX.Text.Trim()) && string.IsNullOrEmpty(TBlocY.Text.Trim()) && string.IsNullOrEmpty(TBlocZ.Text.Trim())) { Notice.Show("货位不能为空!", "错误", 3, MessageBoxIcon.Error); return; } if (!WindowCommon.ConfirmAction("是否进行[手动出入库]任务!!")) { return; } // 货位 string LOC = "C-" + TBlocX.Text.Trim().PadLeft(3, '0') + "-" + TBlocY.Text.Trim().PadLeft(2, '0') + "-" + TBlocZ.Text.Trim().PadLeft(2, '0'); if ((bool)CheckWMS.IsChecked) { // 获取Task资讯 String sql = String.Format(@"select * from wcs_task_info where SITE <> '{1}' and TASK_TYPE = '{2}' and W_S_LOC = '{0}'", LOC, TaskSite.完成, TaskType.出库); DataTable dt = DataControl._mMySql.SelectAll(sql); if (!DataControl._mStools.IsNoData(dt)) { Notice.Show("该货位已存在出库任务!", "错误", 3, MessageBoxIcon.Error); return; } // 无Task资讯则新增 // 呼叫WMS 请求入库资讯---区域 WmsModel wms = new WmsModel() { Task_UID = "NW" + System.DateTime.Now.ToString("yyMMddHHmmss"), Task_type = WmsStatus.StockOutTask, Barcode = "", W_S_Loc = LOC, W_D_Loc = frtD }; // 写入数据库 if (new ForWMSControl().WriteTaskToWCS(wms, out string result)) { Notice.Show("完成!", "成功", 3, MessageBoxIcon.Success); } else { MessageBox.Show("失败!" + result); Notice.Show("失败!" + result, "错误", 3, MessageBoxIcon.Error); } } else { Notice.Show("无法请求WMS出库!", "错误", 3, MessageBoxIcon.Error); } }