protected void btnDelete_Click(object sender, EventArgs e) { string strID = this.txtID.Text; int Count = bll.GetRowCount("VUsed_WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel, "该移库单号已被其它单据使用,请调整后再删除!"); return; } string[] comds = new string[2]; comds[0] = "WMS.DeleteBillMaster"; comds[1] = "WMS.DeleteBillDetail"; List <DataParameter[]> paras = new List <DataParameter[]>(); paras.Add(new DataParameter[] { new DataParameter("{0}", "'" + strID + "'") }); paras.Add(new DataParameter[] { new DataParameter("{0}", string.Format("BillID='{0}'", strID)) }); bll.ExecTran(comds, paras); AddOperateLog("移库单", "删除单号:" + strID); btnNext_Click(sender, e); if (this.txtID.Text == strID) { btnPre_Click(sender, e); if (this.txtID.Text == strID) { BindDataNull(); } } }
protected void btnDeletet_Click(object sender, EventArgs e) { string strColorCode = "'-1',"; BLL.BLLBase bll = new BLL.BLLBase(); for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect")); if (cb != null && cb.Checked) { HyperLink hk = (HyperLink)(this.GridView1.Rows[i].FindControl("HyperLink1")); //判断能否删除 int Count = bll.GetRowCount("VUsed_WMS_BillMaster", string.Format("BillID='{0}'", hk.Text)); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, hk.Text + "移库单号被其它单据使用,请调整后再删除!"); return; } strColorCode += "'" + hk.Text + "',"; } } strColorCode += "'-1'"; string[] comds = new string[2]; comds[0] = "WMS.DeleteBillMaster"; comds[1] = "WMS.DeleteBillDetail"; List<DataParameter[]> paras = new List<DataParameter[]>(); paras.Add(new DataParameter[] { new DataParameter("{0}", strColorCode) }); paras.Add(new DataParameter[] { new DataParameter("{0}", string.Format("BillID in ({0})", strColorCode)) }); bll.ExecTran(comds, paras); AddOperateLog("移库单", "删除单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", "")); DataTable dt = SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, GridView1, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1); SetBindDataSub(dt); }
private void btnRequest_Click(object sender, EventArgs e) { if (blnInStock) { if (Flag == 0) { try { List <string> list = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); DataParameter[] para; //托盘明细, para = new DataParameter[] { new DataParameter("@PalletCode", this.txtPalletCode.Text) }; list.Add("WCS.DeletePalletDetail"); paras.Add(para); for (int i = 0; i < dtPallet.Rows.Count; i++) { para = new DataParameter[] { new DataParameter("@PalletCode", this.txtPalletCode.Text), new DataParameter("@RowID", dtPallet.Rows[i]["RowID"].ToString()), new DataParameter("@ProductCode", dtPallet.Rows[i]["ProductCode"].ToString()) }; list.Add("WCS.InsertPalletDetail"); paras.Add(para); } //任务明细 para = new DataParameter[] { new DataParameter("@TaskNo", this.txtTaskNo.Text) }; list.Add("WCS.DeleteTaskDetail"); paras.Add(para); for (int i = 0; i < dtPallet.Rows.Count; i++) { para = new DataParameter[] { new DataParameter("@TaskNo", this.txtTaskNo.Text), new DataParameter("@RowID", dtPallet.Rows[i]["RowID"].ToString()), new DataParameter("@PalletCode", this.txtPalletCode.Text), new DataParameter("@ProductCode", dtPallet.Rows[i]["ProductCode"].ToString()), new DataParameter("@Quantity", dtPallet.Rows[i]["Quantity"]) }; list.Add("WCS.InsertTaskDetail"); paras.Add(para); } bll.ExecTran(list.ToArray(), paras); } catch (Exception ex) { Logger.Error(ex.Message); return; } } Context.ProcessDispatcher.WriteToService("CarPLC1", "WriteFinished", 1); Logger.Info("托盘条码为 " + this.txtPalletCode.Text + " 开始入库!"); this.DialogResult = DialogResult.OK; } }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); string[] Commands = new string[3]; DataParameter[] para; if (strID == "") //新增 { int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "该入库单已经存在!"); return; } para = new DataParameter[] { new DataParameter("@BillID", this.txtID.Text.Trim()), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@FactoryID", this.ddlFactoryID.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; Commands[0] = "WMS.InsertInStockBill"; } else //修改 { para = new DataParameter[] { new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@FactoryID", this.ddlFactoryID.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("{0}", string.Format("BillID='{0}'", this.txtID.Text.Trim())) }; Commands[0] = "WMS.UpdateInStock"; } try { DataTable dt = (DataTable)Session[FormID + "_Edit_dgViewSub1"]; Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertInStockDetail"; bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt }); } catch (Exception ex) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, ex.Message); return; } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
private void btnSave_Click(object sender, EventArgs e) { string BillID = this.txtBillID.Text.Trim(); if (BillID == "") { Logger.Error("出库单号不能为空,请输入"); this.txtBillID.Focus(); return; } if (dtDetail.Rows.Count == 0) { Logger.Error("明细不能为空."); return; } string[] Commands = new string[3]; Commands[0] = "WMS.UpdateOutPallet"; if (State == "add") { Commands[0] = "WMS.InsertPalletOut"; if (bll.GetRowCount("WMS_BILLMaster", "BillID='" + BillID + "'") > 0) { Logger.Error(BillID + " 空箱出库单号重复,请输入新编号"); return; } for (int i = 0; i < dtDetail.Rows.Count; i++) { dtDetail.Rows[i]["BillID"] = this.txtBillID.Text.Trim(); } } DataParameter[] para = new DataParameter[] { new DataParameter("@BillID", this.txtBillID.Text.Trim()), new DataParameter("@BillDate", this.dtpBillDate.Value), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Program.CurrentUser), new DataParameter("@Updater", Program.CurrentUser) }; Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertOutPalletDetail"; try { bll.ExecTran(Commands, para, "BillID", new DataTable[] { dtDetail }); } catch (Exception ex) { Logger.Error("空箱出库单保存失败,错误原因:" + ex.Message); return; } this.DialogResult = DialogResult.OK; }
private void btnGetBack_Click(object sender, EventArgs e) { try { List <string> list = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); DataParameter[] para; //托盘明细, para = new DataParameter[] { new DataParameter("@PalletCode", this.txtPalletCode.Text) }; list.Add("WCS.DeletePalletDetail"); paras.Add(para); for (int i = 0; i < dtPallet.Rows.Count; i++) { para = new DataParameter[] { new DataParameter("@PalletCode", this.txtPalletCode.Text), new DataParameter("@RowID", dtPallet.Rows[i]["RowID"].ToString()), new DataParameter("@ProductCode", dtPallet.Rows[i]["ProductCode"].ToString()) }; list.Add("WCS.InsertPalletDetail"); paras.Add(para); } //任务明细 para = new DataParameter[] { new DataParameter("@TaskNo", this.txtTaskNo.Text) }; list.Add("WCS.DeleteTaskDetail"); paras.Add(para); for (int i = 0; i < dtPallet.Rows.Count; i++) { para = new DataParameter[] { new DataParameter("@TaskNo", this.txtTaskNo.Text), new DataParameter("@RowID", dtPallet.Rows[i]["RowID"].ToString()), new DataParameter("@PalletCode", this.txtPalletCode.Text), new DataParameter("@ProductCode", dtPallet.Rows[i]["ProductCode"].ToString()), new DataParameter("@Quantity", dtPallet.Rows[i]["Quantity"]) }; list.Add("WCS.InsertTaskDetail"); paras.Add(para); } bll.ExecTran(list.ToArray(), paras); } catch (Exception ex) { Logger.Error(ex.Message); return; } strValue = "1"; this.DialogResult = DialogResult.OK; }
protected void btnSave_Click(object sender, EventArgs e) { if (strID == "") //新增 { int Count = bll.GetRowCount("CMD_ProductType", string.Format("ProductTypeCode='{0}'", this.txtID.Text)); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.Page, "该类别编码已经存在!"); return; } bll.ExecNonQuery("Cmd.InsertProductType", new DataParameter[] { new DataParameter("@ProductTypeCode", this.txtID.Text.Trim()), new DataParameter("@ProductTypeName", this.txtProductTypeName.Text.Trim()), new DataParameter("@WarehouseCode", ""), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }); } else //修改 { List <string> Comd = new List <string>(); Comd.Insert(0, "Cmd.UpdateProductType"); Comd.Insert(1, "Cmd.UpdateProductAreaCode"); List <DataParameter[]> paras = new List <DataParameter[]>(); paras.Insert(0, new DataParameter[] { new DataParameter("@ProductTypeName", this.txtProductTypeName.Text.Trim()), new DataParameter("@WarehouseCode", ""), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("@ProductTypeCode", this.txtID.Text.Trim()) }); paras.Insert(1, new DataParameter[] { new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@ProductTypeCode", this.txtID.Text.Trim()) }); bll.ExecTran(Comd.ToArray(), paras); } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
protected void btnDeletet_Click(object sender, EventArgs e) { string strColorCode = "'-1',"; BLL.BLLBase bll = new BLL.BLLBase(); for (int i = 0; i < this.GridView1.Rows.Count; i++) { CheckBox cb = (CheckBox)(this.GridView1.Rows[i].FindControl("cbSelect")); if (cb != null && cb.Checked) { HyperLink hk = (HyperLink)(this.GridView1.Rows[i].FindControl("HyperLink1")); //判断能否删除 int Count = bll.GetRowCount("VUsed_WMS_BillMaster", string.Format("BillID='{0}'", hk.Text)); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.UpdatePanel1, hk.Text + "移库单号被其它单据使用,请调整后再删除!"); return; } strColorCode += "'" + hk.Text + "',"; } } strColorCode += "'-1'"; string[] comds = new string[2]; comds[0] = "WMS.DeleteBillMaster"; comds[1] = "WMS.DeleteBillDetail"; List <DataParameter[]> paras = new List <DataParameter[]>(); paras.Add(new DataParameter[] { new DataParameter("{0}", strColorCode) }); paras.Add(new DataParameter[] { new DataParameter("{0}", string.Format("BillID in ({0})", strColorCode)) }); bll.ExecTran(comds, paras); AddOperateLog("移库单", "删除单号:" + strColorCode.Replace("'-1',", "").Replace(",'-1'", "")); DataTable dt = SetBtnEnabled(int.Parse(ViewState["CurrentPage"].ToString()), SqlCmd, ViewState["filter"].ToString(), pageSize, GridView1, btnFirst, btnPre, btnNext, btnLast, btnToPage, lblCurrentPage, this.UpdatePanel1); SetBindDataSub(dt); }
protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher) { try { string TaskNo = ""; switch (stateItem.ItemName) { case "TaskFinish": object obj = ObjectUtil.GetObject(stateItem.State); if (obj == null) { return; } string TaskFinish = obj.ToString(); if (TaskFinish.Equals("True") || TaskFinish.Equals("1")) { TaskNo = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(stateItem.Name, "ReadTaskNo"))); DataParameter[] para = new DataParameter[] { new DataParameter("{0}", string.Format("WCS_Task.TaskNo='{0}'", TaskNo)) }; DataTable dt = bll.FillDataTable("WCS.SelectTask", para); string TaskType = ""; if (dt.Rows.Count > 0) { TaskType = dt.Rows[0]["TaskType"].ToString(); } //存储过程处理 if (TaskNo != "") { Logger.Info(stateItem.ItemName + "完成标志,任务号:" + TaskNo); //更新任务状态 List <string> comds = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); comds.Add("WCS.Sp_TaskProcess"); para = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) }; paras.Add(para); bll.ExecTran(comds.ToArray(), paras); //清除堆垛机任务号 sbyte[] taskNo = new sbyte[20]; for (int i = 0; i < 20; i++) { taskNo[i] = 32; } //Util.ConvertStringChar.stringToBytes("", 20).CopyTo(taskNo, 0); WriteToService(stateItem.Name, "TaskNo", taskNo); Send2MJWcs(3, TaskNo); } } break; case "ACK": obj = ObjectUtil.GetObject(stateItem.State); if (obj == null) { return; } string ack = obj.ToString(); if (ack.Equals("True") || ack.Equals("1")) { WriteToService(stateItem.Name, "STB", 0); } break; case "AlarmCode": obj = ObjectUtil.GetObject(stateItem.State); if (obj == null) { return; } string DeviceNo = stateItem.Name.Substring(3, 4); string AlarmCode = obj.ToString(); string AlarmDesc = ""; if (AlarmCode != "0") { DataRow[] drs = dtDeviceAlarm.Select(string.Format("AlarmCode={0}", AlarmCode)); if (drs.Length > 0) { AlarmDesc = drs[0]["AlarmDesc"].ToString(); } else { AlarmDesc = "堆垛机未知错误!"; } //更新任务报警 TaskNo = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(stateItem.Name, "ReadTaskNo"))); if (TaskNo.Length > 0) { DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@AlarmCode", obj), new DataParameter("@AlarmDesc", AlarmDesc) }; bll.ExecNonQueryTran("WCS.UpdateTaskDeviceAlarm", param); Send2MJWcs(2, TaskNo); } Logger.Error("设备编号" + DeviceNo + "发生报警,代号:" + obj.ToString() + ";描述:" + AlarmDesc); } DataParameter[] paramb = new DataParameter[] { new DataParameter("@AlarmCode", obj), new DataParameter("@DeviceNo", DeviceNo) }; bll.ExecNonQueryTran("WCS.UpdateDeviceAlarm", paramb); //上报设备状态 SendDeviceStatus(stateItem.Name, AlarmDesc); break; case "Run": blRun = (int)stateItem.State == 1; if (blRun) { tmWorkTimer.Start(); Logger.Info("堆垛机联机"); } else { tmWorkTimer.Stop(); Logger.Info("堆垛机脱机"); } break; default: break; } } catch (Exception ex) { Logger.Error("CraneProcess StateChanged方法出错,原因:" + ex.Message); } }
public string transInStock(string wmsInStockObject) { WriteToLog("transInStock", wmsInStockObject); DataSet xmlDS = Util.ConvertObj.XmlStringToDataSet(wmsInStockObject); DataTable dt = xmlDS.Tables[0]; string Msg = "成功"; string bln = "Y"; string result = bln + "," + Msg; string strXML1 = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\"?>" + Environment.NewLine + "<DATASETS>" + Environment.NewLine + "<DATASET>" + Environment.NewLine; string strXML2 = Environment.NewLine + "</DATASET>" + Environment.NewLine + "</DATASETS>" + Environment.NewLine; string strResult = "<RESULT>" + result + "</RESULT>"; BLL.BLLBase bll = new BLL.BLLBase(); if (dt.Rows.Count == 0) { bln = "N"; Msg = "内容不能为空!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; } else { DataTable dtCode = dt.DefaultView.ToTable(true, "BillNo"); List<string> list = new List<string>(); List<DataParameter[]> paras = new List<DataParameter[]>(); DataParameter[] para; string strWhere = "'-1'"; string strBillID = bll.GetAutoCodeByTableName("IS", "WMS_BillMaster", DateTime.Now, "1=1"); string BillID = strBillID; for (int k = 0; k < dtCode.Rows.Count; k++) { if (k != 0) { BillID = Util.Utility.NewID(strBillID); strBillID = BillID; } string BillNo=dtCode.Rows[k]["BillNo"].ToString().Replace("'", "''"); int HasCount = bll.GetRowCount("WMS_BillMaster", string.Format("SourceBillNo='{0}' and BillID like 'IS%' and SourceBillNo!=''", BillNo)); if (HasCount > 0) { bln = "N"; Msg = "单号" + BillNo + "已经传入WMS,不能再次传递!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; } DataRow[] drs = dt.Select(string.Format("BillNo='{0}'", BillNo)); for (int i = 0; i < drs.Length; i++) { //判断该熔次卷号是否在库存中 DataRow dr = drs[i]; HasCount = bll.GetRowCount("CMD_CELL", string.Format("Barcode like '%{0}%'", dr["BatchNo"].ToString())); if (HasCount > 0) { bln = "N"; Msg = "熔次卷号" + dr["BatchNo"].ToString() + "已经传入WMS,不能再次传递!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; } //判断是否有在未执行的入库任务中 HasCount = bll.GetRowCount("WCS_Task", string.Format("TaskType='11' and Barcode like '%{0}%' and state<7", dr["BatchNo"].ToString())); if (HasCount > 0) { bln = "N"; Msg = "熔次卷号" + dr["BatchNo"].ToString() + "已经传入WMS,不能再次传递!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; } list.Add("WMSServices.InsertBillTemp"); para = new DataParameter[] { new DataParameter("@BillType","IS"), new DataParameter("@BillNo",dr["BillNo"]), new DataParameter("@BillDate",dr["BillDate"]), new DataParameter("@BatchNo",dr["BatchNo"]), new DataParameter("@ProductCode",dr["ProductCode"]), new DataParameter("@Size",dr["Size"]), new DataParameter("@Weight",dr["Weight"]), new DataParameter("@Quantity",1), new DataParameter("@Memo",dr["Memo"]) }; paras.Add(para); } list.Add("WMSServices.InsertInStock");//插入主表 para = new DataParameter[] { new DataParameter("@BillID", BillID), new DataParameter("@BillNo", BillNo) }; paras.Add(para); list.Add("WMSServices.InsertInStockDetail"); //从表 para = new DataParameter[] { new DataParameter("@BillID", BillID), new DataParameter("@BillNo", BillNo) }; paras.Add(para); strWhere += ",'" + BillID + "'"; list.Add("WMSServices.DeleteBillTemp"); para = new DataParameter[] { new DataParameter("@BillType","IS"), new DataParameter("@BillNo",BillNo) }; paras.Add(para); } list.Add("WMSServices.SpInstockTask");//入库作业 para = new DataParameter[] { new DataParameter("@strWhere", strWhere), new DataParameter("@UserName", "WebServices") }; paras.Add(para); try { bll.ExecTran(list.ToArray(), paras); } catch (Exception ex) { Msg = ex.Message; bln = "N"; } } result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); string[] Commands = new string[3]; DataParameter[] para; if (strID == "") //新增 { int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "该移库库单已经存在!"); return; } para = new DataParameter[] { new DataParameter("@BillID", this.txtID.Text.Trim()), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", "030"), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; Commands[0] = "WMS.InsertMoveStockBill"; } else //修改 { para = new DataParameter[] { new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("{0}", string.Format("BillID='{0}'", this.txtID.Text.Trim())) }; Commands[0] = "WMS.UpdateMoveStock"; } DataTable dt = (DataTable)Session[FormID + "_Edit_dgViewSub1"]; //判断货位是否被其他单据锁定 for (int i = 0; i < dt.Rows.Count; i++) { int count = 0; count = bll.GetRowCount("Cmd_Cell", string.Format("CellCode='{0}' and IsLock=1", dt.Rows[i]["CellCode"])); if (count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "货位 " + dt.Rows[i]["CellCode"].ToString() + "已经被其它单据锁定,不能移库!"); return; } count = bll.GetRowCount("Cmd_Cell", string.Format("CellCode='{0}' and IsLock=1", dt.Rows[i]["NewCellCode"])); if (count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "货位 " + dt.Rows[i]["NewCellCode"].ToString() + "已经被其它单据锁定,不能移库!"); return; } } try { Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertMoveStockDetail"; bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt }); } catch (Exception ex) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, ex.Message); return; } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
protected override void StateChanged(StateItem stateItem, IProcessDispatcher dispatcher) { try { string TaskNo = ""; string PalletBarcode = ""; switch (stateItem.ItemName) { case "TaskFinish": object obj = ObjectUtil.GetObject(stateItem.State); if (obj == null) { return; } string TaskFinish = obj.ToString(); if (TaskFinish.Equals("True") || TaskFinish.Equals("1")) { //TaskNo = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(stateItem.Name, "ReadTaskNo"))); //DataParameter[] para = new DataParameter[] { new DataParameter("{0}", string.Format("WCS_Task.TaskNo='{0}'", TaskNo)) }; PalletBarcode = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(stateItem.Name, "ReadTaskNo"))); DataParameter[] para = new DataParameter[] { new DataParameter("{0}", string.Format("WCS_Task.PalletBarcode='{0}' and WCS_TASK.State!=0 and WCS_TASK.State<7", PalletBarcode)) }; DataTable dt = bll.FillDataTable("WCS.SelectTask", para); TaskNo = dt.Rows[0]["TaskNo"].ToString(); string TaskType = ""; if (dt.Rows.Count > 0) { TaskType = dt.Rows[0]["TaskType"].ToString(); } //存储过程处理 if (TaskNo != "") { Logger.Info(stateItem.ItemName + "完成标志,任务号:" + TaskNo); //更新任务状态 List <string> comds = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); comds.Add("WCS.Sp_TaskProcess"); para = new DataParameter[] { new DataParameter("@TaskNo", TaskNo) }; paras.Add(para); bll.ExecTran(comds.ToArray(), paras); //清除堆垛机任务号 sbyte[] taskNo = new sbyte[20]; for (int i = 0; i < 20; i++) { taskNo[i] = 32; } //Util.ConvertStringChar.stringToBytes("", 20).CopyTo(taskNo, 0); WriteToService(stateItem.Name, "TaskNo", taskNo); //Thread th = new Thread(new ThreadStart(ThreadMethod)); //也可简写为new Thread(ThreadMethod); //th.Start(); //启动线程 report.Send2MJWcs(base.Context, 3, TaskNo); } } break; case "ACK": obj = ObjectUtil.GetObject(stateItem.State); if (obj == null) { return; } string ack = obj.ToString(); Logger.Info(stateItem.Name + " Receive ACK:" + ack); if (ack.Equals("True") || ack.Equals("1")) { WriteToService(stateItem.Name, "STB", 0); Logger.Info(stateItem.Name + " Receive ACK 1"); } break; case "Run": blRun = (int)stateItem.State == 1; if (blRun) { tmWorkTimer.Start(); Logger.Info("堆垛机联机"); } else { tmWorkTimer.Stop(); Logger.Info("堆垛机脱机"); } break; default: break; } } catch (Exception ex) { Logger.Error("CraneProcess StateChanged方法出错,原因:" + ex.Message); } }
public string transWmsProduct(string wmsProductObject) { try { string str = GetUnicodeString(wmsProductObject); WriteToLog("transWmsProduct", str); } catch (Exception ex) { } //byte[] bt = Convert.FromBase64String(wmsProductObject); //string strs = System.Text.Encoding.Default.GetString(bt); //string strs1 = System.Text.Encoding.UTF8.GetString(bt); WriteToLog("transWmsProduct", wmsProductObject); //WriteToLog("transWmsProduct", strs); //WriteToLog("transWmsProduct", strs1); DataSet xmlDS = Util.ConvertObj.XmlStringToDataSet(wmsProductObject); DataTable dt = xmlDS.Tables[0]; string Msg = "成功"; string bln = "Y"; string result = bln + "," + Msg; string strXML1 = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\"?>" + Environment.NewLine + "<DATASETS>" + Environment.NewLine + "<DATASET>" + Environment.NewLine; string strXML2 = Environment.NewLine + "</DATASET>" + Environment.NewLine + "</DATASETS>" + Environment.NewLine; string strResult = "<RESULT>" + result + "</RESULT>"; if (dt.Rows.Count == 0) { bln = "N"; Msg = "内容不能为空!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return(strXML1 + strResult + strXML2); } string[] Comds = new string[dt.Rows.Count]; List <DataParameter[]> paras = new List <DataParameter[]>(); BLL.BLLBase bll = new BLL.BLLBase(); string strProductCode = bll.GetNewID("CMD_Product", "ProductCode", "1=1"); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; int HasCount = bll.GetRowCount("CMD_Product", string.Format("ProductNo='{0}' and Spec='{1}'", dr["ProductOldCode"].ToString().Replace("'", "''"), dr["OldSize"].ToString().Replace("'", "''"))); DataParameter[] para; if (HasCount > 0) { Comds[i] = "WMSServices.UpdateProduct"; para = new DataParameter[] { new DataParameter("@ProductCode", dr["ProductCode"].ToString()), new DataParameter("@ProductName", dr["ProductName"].ToString()), new DataParameter("@ProductEName", dr["ProductEName"].ToString()), new DataParameter("@Size", dr["Size"].ToString()), new DataParameter("@AlloyTemper", dr["AlloyTemper"].ToString()), new DataParameter("@Weight", dr["Weight"].ToString()), new DataParameter("@ProductType", dr["ProductType"].ToString()), new DataParameter("@StandardNo", dr["StandardNo"].ToString()), new DataParameter("@PartNo", dr["PartNo"].ToString()), new DataParameter("@Memo", dr["Memo"].ToString()), new DataParameter("@ProductOldCode", dr["ProductOldCode"].ToString()), new DataParameter("@OldSize", dr["OldSize"].ToString()) }; } else { Comds[i] = "WMSServices.InsertProduct"; string strWmsProductCode = Util.Utility.NewID(strProductCode); strProductCode = strWmsProductCode; para = new DataParameter[] { new DataParameter("@ProductWMSCode", strWmsProductCode), new DataParameter("@ProductCode", dr["ProductCode"].ToString()), new DataParameter("@ProductName", dr["ProductName"].ToString()), new DataParameter("@ProductEName", dr["ProductEName"].ToString()), new DataParameter("@Size", dr["Size"].ToString()), new DataParameter("@AlloyTemper", dr["AlloyTemper"].ToString()), new DataParameter("@Weight", dr["Weight"].ToString()), new DataParameter("@ProductType", dr["ProductType"].ToString()), new DataParameter("@StandardNo", dr["StandardNo"].ToString()), new DataParameter("@PartNo", dr["PartNo"].ToString()), new DataParameter("@Memo", dr["Memo"].ToString()) }; } paras.Add(para); } try { bll.ExecTran(Comds, paras); } catch (Exception ex) { Msg = ex.Message; bln = "N"; } result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return(strXML1 + strResult + strXML2); }
public string transOutStock(string wmsOutStockObject) { WriteToLog("transOutStock", wmsOutStockObject); DataSet xmlDS = Util.ConvertObj.XmlStringToDataSet(wmsOutStockObject); DataTable dt = xmlDS.Tables[0]; string Msg = "成功"; string bln = "Y"; string result = bln + "," + Msg; string strXML1 = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\"?>" + Environment.NewLine + "<DATASETS>" + Environment.NewLine + "<DATASET>" + Environment.NewLine; string strXML2 = Environment.NewLine + "</DATASET>" + Environment.NewLine + "</DATASETS>" + Environment.NewLine; string strResult = "<RESULT>" + result + "</RESULT>"; BLL.BLLBase bll = new BLL.BLLBase(); DataTable dtCode = dt.DefaultView.ToTable(true, "BillNo"); if (dtCode.Rows.Count == 0) { bln = "N"; Msg = "内容不能为空!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return(strXML1 + strResult + strXML2); } else { List <string> list = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); DataParameter[] para; string strBillID = bll.GetAutoCodeByTableName("OS", "WMS_BillMaster", DateTime.Now, "1=1"); string BillID = strBillID; for (int k = 0; k < dtCode.Rows.Count; k++) { if (k != 0) { BillID = Util.Utility.NewID(strBillID); strBillID = BillID; } string BillNo = dtCode.Rows[k]["BillNo"].ToString().Replace("'", "''"); int HasCount = bll.GetRowCount("WMS_BillMaster", string.Format("SourceBillNo='{0}' and BillID like 'OS%'", BillNo)); if (HasCount > 0) { bln = "N"; Msg = "单号" + dtCode.Rows[0]["BillNo"].ToString() + "已经传入WMS,不能再次传递!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return(strXML1 + strResult + strXML2); } list.Add("WMSServices.DeleteBillTemp"); para = new DataParameter[] { new DataParameter("@BillType", "OS"), new DataParameter("@BillNo", BillNo) }; paras.Add(para); DataRow[] drs = dt.Select(string.Format("BillNo='{0}'", BillNo)); for (int i = 0; i < drs.Length; i++) { DataRow dr = drs[i]; HasCount = bll.GetRowCount("CMD_CELL", string.Format("Barcode='{0}' and IsLock=0 and InDate is not null", dr["BatchNo"])); if (HasCount == 0) { bln = "N"; Msg = "单号:" + dtCode.Rows[0]["BillNo"].ToString() + " 熔次卷号:" + dr["BatchNo"] + " 库存数量为零无法出库!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return(strXML1 + strResult + strXML2); } list.Add("WMSServices.InsertBillTemp"); para = new DataParameter[] { new DataParameter("@BillType", "OS"), new DataParameter("@BillNo", dr["BillNo"]), new DataParameter("@BillDate", dr["BillDate"]), new DataParameter("@BatchNo", dr["BatchNo"]), new DataParameter("@ProductCode", dr["ProductCode"]), new DataParameter("@Size", dr["Size"]), new DataParameter("@Weight", dr["Weight"]), new DataParameter("@Quantity", 1), new DataParameter("@Memo", dr["Memo"]) }; paras.Add(para); } list.Add("WMSServices.InsertOutStock");//插入主表 para = new DataParameter[] { new DataParameter("@BillID", BillID), new DataParameter("@BillNo", BillNo) }; paras.Add(para); list.Add("WMSServices.InsertOutStockDetail"); //从表 para = new DataParameter[] { new DataParameter("@BillID", BillID), new DataParameter("@BillNo", BillNo) }; paras.Add(para); } try { bll.ExecTran(list.ToArray(), paras); } catch (Exception ex) { Msg = ex.Message; bln = "N"; } } result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return(strXML1 + strResult + strXML2); }
private void btnGetBack_Click(object sender, EventArgs e) { try { List <string> list = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); DataParameter[] para; //删除托盘明细 para = new DataParameter[] { new DataParameter("@PalletCode", this.txtPalletCode.Text) }; list.Add("WCS.DeletePalletDetail"); paras.Add(para); //增加托盘明细 DataRow[] drs = dtPallet.Select("RealQty<>0"); for (int i = 0; i < drs.Length; i++) { para = new DataParameter[] { new DataParameter("@PalletCode", this.txtPalletCode.Text), new DataParameter("@RowID", i + 1), new DataParameter("@ProductCode", drs[i]["ProductCode"].ToString()), new DataParameter("@Quantity", drs[i]["RealQty"]), new DataParameter("@InDate", drs[i]["InDate"]), new DataParameter("@CellCode", this.txtCellCode.Text) }; list.Add("WCS.InsertPallet"); paras.Add(para); } para = new DataParameter[] { new DataParameter("@BillID", this.txtBillID.Text), new DataParameter("@PalletCode", this.txtPalletCode.Text) }; list.Add("WCS.DeleteCheckDetail"); paras.Add(para); //增加盘点明细 drs = dtPallet.Select("", "RowID"); for (int i = 0; i < drs.Length; i++) { para = new DataParameter[] { new DataParameter("@BillID", this.txtBillID.Text), new DataParameter("@PalletCode", this.txtPalletCode.Text), new DataParameter("@RowID", i + 1), new DataParameter("@CellCode", this.txtCellCode.Text), new DataParameter("@TaskNo", this.txtTaskNo.Text), new DataParameter("@ProductCode", drs[i]["ProductCode"].ToString()), new DataParameter("@Quantity", drs[i]["Quantity"]), new DataParameter("@RealQty", drs[i]["RealQty"]), new DataParameter("@DiffQty", (int)drs[i]["RealQty"] - (int)drs[i]["Quantity"]) }; list.Add("WCS.InsertCheckDetail"); paras.Add(para); } //现有托盘与实际托盘不符 if (PalletCode.ToLower() != this.txtPalletCode.Text.Trim().ToLower()) { //更新任务,托盘号与实际托盘不符 para = new DataParameter[] { new DataParameter("@BarCode", "现有托盘号:" + this.txtPalletCode.Text.Trim()), new DataParameter("@TaskNo", this.txtTaskNo.Text) }; list.Add("WCS.UpdateCheckWCSTaskError"); paras.Add(para); para = new DataParameter[] { new DataParameter("@PalletBarCode", this.txtPalletCode.Text.Trim()), new DataParameter("@CellCode", this.txtCellCode.Text) }; list.Add("WCS.UpdateCheckCellError"); paras.Add(para); //更新货位托盘号 } bll.ExecTran(list.ToArray(), paras); } catch (Exception ex) { MCP.Logger.Error(ex.Message); return; } blnOk = true; strValue = "1"; this.DialogResult = DialogResult.OK; }
protected void btnSave_Click(object sender, EventArgs e) { UpdateTempSub(this.dgViewSub1); string[] Commands = new string[3]; DataParameter[] para; //判断库存 DataTable dt = (DataTable)Session[FormID + "_Edit_dgViewSub1"]; DataTable dtProduct = dt.DefaultView.ToTable("Product", true, new string[] { "ProductCode", "ProductName" }); for (int i = 0; i < dtProduct.Rows.Count; i++) { object o = dt.Compute("Sum(Quantity)", string.Format("ProductCode='{0}'", dtProduct.Rows[i]["ProductCode"])); if (o != null) { int Qty = int.Parse(o.ToString()); DataTable dtProductQty = bll.FillDataTable("WMS.SelectProductQty", new DataParameter[] { new DataParameter("@BillID", this.txtID.Text), new DataParameter("@ProductCode", dtProduct.Rows[i]["ProductCode"].ToString()) }); int StockQty = 0; bool blnvalue = false; if (dtProductQty.Rows.Count == 0) { blnvalue = true; } else { StockQty = int.Parse(dtProductQty.Rows[0]["StockQty"].ToString()); if (Qty > StockQty) { blnvalue = true; } } if (blnvalue) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, dtProduct.Rows[i]["ProductName"].ToString() + "现有库存数量为:" + StockQty.ToString() + ", 库存不足,请修改出库数量。"); return; } } } if (strID == "") //新增 { int Count = bll.GetRowCount("WMS_BillMaster", string.Format("BillID='{0}'", this.txtID.Text.Trim())); if (Count > 0) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, "该出库单已经存在!"); return; } para = new DataParameter[] { new DataParameter("@BillID", this.txtID.Text.Trim()), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@TrainTypeCode", this.ddlTrainTypeCode.SelectedValue), new DataParameter("@TrainNo", this.txtTrainNo.Text), new DataParameter("@AxieLocation", this.txtAxieLocation.Text), new DataParameter("@Xc", this.txtXc.Text), new DataParameter("@Ccnz", this.txtCcnz.Text), new DataParameter("@Ccwz", this.txtCcwz.Text), new DataParameter("@Fccnz", this.txtFccnz.Text), new DataParameter("@Fccwz", this.txtFccwz.Text), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Creator", Session["EmployeeCode"].ToString()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()) }; Commands[0] = "WMS.InsertOutStockBill"; } else //修改 { para = new DataParameter[] { new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillDate", this.txtBillDate.DateValue), new DataParameter("@BillTypeCode", this.ddlBillTypeCode.SelectedValue), new DataParameter("@AreaCode", this.ddlAreaCode.SelectedValue), new DataParameter("@TrainTypeCode", this.ddlTrainTypeCode.SelectedValue), new DataParameter("@TrainNo", this.txtTrainNo.Text), new DataParameter("@AxieLocation", this.txtAxieLocation.Text), new DataParameter("@Xc", this.txtXc.Text), new DataParameter("@Ccnz", this.txtCcnz.Text), new DataParameter("@Ccwz", this.txtCcwz.Text), new DataParameter("@Fccnz", this.txtFccnz.Text), new DataParameter("@Fccwz", this.txtFccwz.Text), new DataParameter("@Memo", this.txtMemo.Text.Trim()), new DataParameter("@Updater", Session["EmployeeCode"].ToString()), new DataParameter("{0}", string.Format("BillID='{0}'", this.txtID.Text.Trim())) }; Commands[0] = "WMS.UpdateOutStock"; } try { Commands[1] = "WMS.DeleteBillDetail"; Commands[2] = "WMS.InsertInStockDetail"; bll.ExecTran(Commands, para, "BillID", new DataTable[] { dt }); } catch (Exception ex) { WMS.App_Code.JScript.Instance.ShowMessage(this.updatePanel1, ex.Message); return; } Response.Redirect(FormID + "View.aspx?SubModuleCode=" + SubModuleCode + "&FormID=" + Server.UrlEncode(FormID) + "&SqlCmd=" + SqlCmd + "&ID=" + Server.UrlEncode(this.txtID.Text)); }
public string transWmsProduct(string wmsProductObject) { WriteToLog("transWmsProduct", wmsProductObject); DataSet xmlDS = Util.ConvertObj.XmlStringToDataSet(wmsProductObject); DataTable dt = xmlDS.Tables[0]; DataTable dtNew = dt.DefaultView.ToTable(true, "ProductCode", "Size"); string Msg = "成功"; string bln = "Y"; string result = bln + "," + Msg; string strXML1 = "<?xml version=\"1.0\" encoding=\"GB2312\" standalone=\"yes\"?>" + Environment.NewLine + "<DATASETS>" + Environment.NewLine + "<DATASET>" + Environment.NewLine; string strXML2 = Environment.NewLine + "</DATASET>" + Environment.NewLine + "</DATASETS>" + Environment.NewLine; string strResult = "<RESULT>" + result + "</RESULT>"; if (dt.Rows.Count == 0) { bln = "N"; Msg = "内容不能为空!"; result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; } string[] Comds = new string[dt.Rows.Count]; List<DataParameter[]> paras = new List<DataParameter[]>(); BLL.BLLBase bll = new BLL.BLLBase(); string strProductCode = bll.GetNewID("CMD_Product", "ProductCode", "1=1"); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; int HasCount = bll.GetRowCount("CMD_Product", string.Format("ProductNo='{0}' and Spec='{1}'", dr["ProductOldCode"].ToString().Replace("'", "''"), dr["OldSize"].ToString().Replace("'", "''"))); DataParameter[] para; if (HasCount > 0) { Comds[i] = "WMSServices.UpdateProduct"; para = new DataParameter[] { new DataParameter("@ProductCode",dr["ProductCode"].ToString()), new DataParameter("@ProductName",dr["ProductName"].ToString()), new DataParameter("@ProductEName",dr["ProductEName"].ToString()), new DataParameter("@Size",dr["Size"].ToString()), new DataParameter("@AlloyTemper",dr["AlloyTemper"].ToString()), new DataParameter("@Weight",dr["Weight"].ToString()), new DataParameter("@ProductType",dr["ProductType"].ToString()), new DataParameter("@StandardNo",dr["StandardNo"].ToString()), new DataParameter("@PartNo",dr["PartNo"].ToString()), new DataParameter("@Memo",dr["Memo"].ToString()), new DataParameter("@ProductOldCode",dr["ProductOldCode"].ToString()), new DataParameter("@OldSize",dr["OldSize"].ToString()) }; } else { Comds[i] = "WMSServices.InsertProduct"; string strWmsProductCode = strProductCode; strProductCode = Util.Utility.NewID(strWmsProductCode); para = new DataParameter[] { new DataParameter("@ProductWMSCode",strWmsProductCode), new DataParameter("@ProductCode",dr["ProductCode"].ToString()), new DataParameter("@ProductName",dr["ProductName"].ToString()), new DataParameter("@ProductEName",dr["ProductEName"].ToString()), new DataParameter("@Size",dr["Size"].ToString()), new DataParameter("@AlloyTemper",dr["AlloyTemper"].ToString()), new DataParameter("@Weight",dr["Weight"].ToString()), new DataParameter("@ProductType",dr["ProductType"].ToString()), new DataParameter("@StandardNo",dr["StandardNo"].ToString()), new DataParameter("@PartNo",dr["PartNo"].ToString()), new DataParameter("@Memo",dr["Memo"].ToString()) }; } paras.Add(para); } try { bll.ExecTran(Comds, paras); } catch (Exception ex) { Msg = ex.Message; bln = "N"; } result = bln + "," + Msg; strResult = "<RESULT>" + result + "</RESULT>"; return strXML1 + strResult + strXML2; }
public string transSRMTask(string wcsProductObject) { DataTable dt = Util.JsonHelper.Json2Dtb(wcsProductObject); string json = "[{\"id\":" + dt.Rows[0]["id"] + ",\"returnCode\":000" + ",\"message\":\"成功\""; BLL.BLLBase bll = new BLL.BLLBase(); if (dt.Rows.Count == 0) { return(json = "[{\"id\":" + dt.Rows[0]["id"] + ",\"returnCode\":001" + ",\"message\":\"失败\"" + ",\"finishDate\":" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") + "}]"); } bll.BatchInsertTable(dt, "WCS_TaskTemp"); List <string> list = new List <string>(); List <DataParameter[]> paras = new List <DataParameter[]>(); DataParameter[] para; foreach (DataRow row in dt.Rows) { string billTypeCode; string CellCode = row["fromAddress"].ToString(); string ToCellCode = ""; string AisleNo = ""; string AreaCode = "B01"; switch (row["taskType"].ToString()) { case "11": billTypeCode = "001"; CellCode = row["toAddress"].ToString(); break; case "12": billTypeCode = "020"; break; case "13": billTypeCode = "030"; ToCellCode = row["toAddress"].ToString(); break; case "15": billTypeCode = "050"; break; case "16": billTypeCode = "070"; break; default: billTypeCode = "060"; break; } string As = CellCode.Substring(2, 1); if (AreaCode == "A01") { if (As == "1" || As == "2" || As == "3") { AisleNo = "01"; } else if (As == "4" || As == "5" || As == "6") { AisleNo = "02"; } else if (As == "7" || As == "8" || As == "9" || As == "10") { AisleNo = "03"; } else { AisleNo = "04"; } } else if (AreaCode == "B01") { if (As == "1" || As == "2" || As == "3" || As == "4") { AisleNo = "01"; } else if (As == "5" || As == "6" || As == "7") { AisleNo = "02"; } else { AisleNo = "03"; } } if (row["taskFlag"].ToString() == "1") { list.Add("WCS.InsertTestWCSTask"); para = new DataParameter[] { new DataParameter("@TaskID", row["taskNo"]), new DataParameter("@TaskNo", row["taskNo"]), new DataParameter("@BillTypeCode", billTypeCode), new DataParameter("@TaskType", row["taskType"]), new DataParameter("@TaskLevel", row["taskLevel"]), new DataParameter("@PalletBarcode", row["palletBarcode"]), new DataParameter("@DeviceNo", ""), new DataParameter("@AisleNo", AisleNo), new DataParameter("@CellCode", CellCode), new DataParameter("@ToCellCode", ToCellCode), new DataParameter("@State", row["status"]), new DataParameter("@Tasker", row["sender"]), new DataParameter("@TaskDate", DateTime.ParseExact(row["sendDate"].ToString(), "yyyy-MM-dd HH:mm:ss fff", null)), new DataParameter("@RequestDate", null), new DataParameter("@StartDate", null), new DataParameter("@FinishDate", null), new DataParameter("@AlarmCode", "0"), new DataParameter("@AlarmDesc", ""), new DataParameter("@AreaCode", AreaCode), new DataParameter("@StationNo", "02") }; paras.Add(para); } else if (row["taskFlag"].ToString() == "2") { list.Add("WCS.UpdateTestWCSTask"); para = new DataParameter[] { new DataParameter("@BillTypeCode", billTypeCode), new DataParameter("@TaskType", row["taskType"]), new DataParameter("@TaskLevel", row["taskLevel"]), new DataParameter("@PalletBarcode", row["palletBarcode"]), new DataParameter("@AisleNo", AisleNo), new DataParameter("@CellCode", CellCode), new DataParameter("@ToCellCode", ToCellCode), new DataParameter("@State", row["status"]), new DataParameter("@Tasker", row["sender"]), new DataParameter("@TaskDate", DateTime.ParseExact(row["sendDate"].ToString(), "yyyy-MM-dd HH:mm:ss fff", null)), new DataParameter("@AreaCode", "A01"), new DataParameter("@TaskNo", row["taskNo"]) }; paras.Add(para); } else { list.Add("WCS.DeleteTestWCSTask"); para = new DataParameter[] { }; paras.Add(para); } } try { bll.ExecTran(list.ToArray(), paras); } catch (Exception ex) { throw ex; } json = json + ",\"finishDate\":" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") + "}]"; return(json); }