public TaskRtn transWCSTask(List <Task> list) { lock (this) { string Json = List2Json(list); Log.WriteToLog("1", "transSRMTask--Rec", Json); string rtnMessage = ""; string id = ""; TaskRtn taskRtn = new TaskRtn(); try { DataTable dt = Util.JsonHelper.Json2Dtb(Json); if (dt.Rows.Count > 0) { id = dt.Rows[0]["id"].ToString(); } else { id = ""; } BLL.BLLBase bll = new BLL.BLLBase(); bll.ExecNonQuery("WCS.DeleteWcsTemp"); bll.BatchInsertTable(dt, "WCS_TaskTemp"); DataTable dtTask = bll.FillDataTable("WCS.Sp_ImportWmsTask"); if (dtTask.Rows.Count > 0) { taskRtn.id = id; taskRtn.returnCode = "000"; taskRtn.message = "成功"; taskRtn.finishDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); taskRtn.field1 = "null"; rtnMessage = "{\"id\":\"" + id + "\",\"returnCode\":\"000\"" + ",\"message\":\"成功\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"null\"}"; } else { taskRtn.id = id; taskRtn.returnCode = "001"; taskRtn.message = "失败"; taskRtn.finishDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); taskRtn.field1 = "null"; rtnMessage = "{\"id\":\"" + id + "\",\"returnCode\":\"001\"" + ",\"message\":\"" + taskRtn.message + "\"" + ",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"null\"}"; } } catch (Exception ex) { taskRtn.id = id; taskRtn.returnCode = "001"; taskRtn.message = ex.Message; taskRtn.finishDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); taskRtn.field1 = "null"; rtnMessage = "{\"id\":\"" + id + "\",\"returnCode\":\"001\"" + ",\"message\":\"" + ex.Message + "\"" + ",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"" + ex.Message + "\"}"; } Log.WriteToLog("1", "transSRMTask-Rtn", rtnMessage); return(taskRtn); //return rtnMessage; } }
public string ImportWCSTask(string taskData) { Log.WriteToLog("1", "transSRMTask-Rec", taskData); string json = ""; string id = ""; string state = ""; string State = ""; try { DataTable dt = Util.JsonHelper.Json2Dtb(taskData); if (dt.Rows.Count > 0) { id = dt.Rows[0]["id"].ToString(); } else { id = ""; } bll.ExecNonQuery("WCS.DeleteWcsTemp"); bll.BatchInsertTable(dt, "WCS_TaskTemp"); bll.ExecNonQueryTran("WCS.Sp_ImportWmsTask"); json = "{\"id\":\"" + id + "\",\"returnCode\":\"000\"" + ",\"message\":\"成功\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"null\"}"; } catch (Exception ex) { json = "{\"id\":\"" + id + "\",\"returnCode\":\"001\"" + ",\"message\":\"" + ex.Message + "\"" + ",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"" + ex.Message + "\"}"; } Log.WriteToLog("1", "transSRMTask-Rtn", json); return(json); }
public string transSRMTaskAisle(string wcsProductObject) { BLL.BLLBase bll = new BLL.BLLBase(); DataTable dt = Util.JsonHelper.Json2Dtb(wcsProductObject); string json; 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_AisleTemp"); string Aisle = ""; string AreaCode = "002"; //获取有空货位的货架 //select ShelfCode,COUNT(*) from CMD_Cell where PalletBarCode='' and AreaCode='001' //group by ShelfCode //order by ShelfCode DataTable dtSelectAisle = bll.FillDataTable("Cmd.SelectDevice", new DataParameter("{0}", AreaCode)); if (dtSelectAisle.Rows.Count != 0) { Aisle = dtSelectAisle.Rows[0]["AisleNo"].ToString(); } else { DataTable AisleDt = bll.FillDataTable("Wcs.SelectTestAisle", new DataParameter("@AreaCode", AreaCode)); Aisle = AisleDt.Rows[0]["AisleNo"].ToString(); } json = "[{\"id\":" + dt.Rows[0]["id"] + "\"taskNo\":" + dt.Rows[0]["taskNo"] + "\"aisleNo\":" + Aisle.ToString() + "\"finishDate\":" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff") + "}]"; return(json); }
//总控WCS入库巷道请求 public TaskAisleRtn transWCSTaskAisle(List <TaskAisle> list) { string Json = List2Json(list); Log.WriteToLog("1", "transSRMTaskAisle-Rec", Json); string rtnMessage = ""; string id = ""; string taskNo = ""; string Aisle = ""; string WarehouseCode = ""; TaskAisleRtn taskAisleRtn = new TaskAisleRtn(); try { BLL.BLLBase bll = new BLL.BLLBase(); DataTable dt = Util.JsonHelper.Json2Dtb(Json); if (dt.Rows.Count > 0) { id = dt.Rows[0]["id"].ToString(); taskNo = dt.Rows[0]["taskNo"].ToString(); WarehouseCode = dt.Rows[0]["warehouseCode"].ToString(); } else { id = ""; taskNo = ""; WarehouseCode = ""; } bll.BatchInsertTable(dt, "WCS_AisleTemp"); DataTable dtSelectAisle = bll.FillDataTable("Cmd.AisleRequest", new DataParameter("{0}", string.Format("WarehouseCode='{0}'", WarehouseCode))); //DataTable dtSelectAisle = bll.FillDataTable("Cmd.AisleRequest"); if (dtSelectAisle.Rows.Count > 0) { Aisle = dtSelectAisle.Rows[0]["AisleNo"].ToString(); } taskAisleRtn.id = id; taskAisleRtn.taskNo = taskNo; taskAisleRtn.aisleNo = Aisle; taskAisleRtn.finishDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); taskAisleRtn.field1 = "null"; rtnMessage = "{\"id\":\"" + id + "\",\"taskNo\":\"" + taskNo + "\",\"aisleNo\":\"" + Aisle + "\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"null\"}"; } catch (Exception ex) { rtnMessage = "{\"id\":\"" + id + "\",\"taskNo\":\"" + taskNo + "\",\"aisleNo\":\"" + Aisle + "\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"" + ex.Message + "\"}"; } Log.WriteToLog("1", "transSRMTaskAisle-Rtn", rtnMessage); return(taskAisleRtn); //return rtnMessage; }
public string RequestWCSTaskAisle(string taskData) { Log.WriteToLog("1", "transSRMTaskAisle-Rec", taskData); string json = ""; string id = ""; string taskNo = ""; string Aisle = ""; string WarehouseCode = ""; try { DataTable dt = Util.JsonHelper.Json2Dtb(taskData); if (dt.Rows.Count > 0) { id = dt.Rows[0]["id"].ToString(); taskNo = dt.Rows[0]["taskNo"].ToString(); WarehouseCode = dt.Rows[0]["WarehouseCode"].ToString(); } else { id = ""; taskNo = ""; WarehouseCode = ""; } bll.BatchInsertTable(dt, "WCS_AisleTemp"); DataTable dtSelectAisle = bll.FillDataTable("Cmd.AisleRequest", new DataParameter("{0}", string.Format("WarehouseCode='{0}'", WarehouseCode))); //DataTable dtSelectAisle = bll.FillDataTable("Cmd.AisleRequest"); Aisle = dtSelectAisle.Rows[0]["AisleNo"].ToString(); json = "{\"id\":\"" + id + "\",\"taskNo\":\"" + taskNo + "\",\"aisleNo\":\"" + Aisle + "\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"null\"}"; } catch (Exception ex) { json = "{\"id\":\"" + id + "\",\"taskNo\":\"" + taskNo + "\",\"aisleNo\":\"" + Aisle + "\",\"finishDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"field1\":\"" + ex.Message + "\"}"; } Log.WriteToLog("1", "transSRMTaskAisle-Rtn", json); return(json); }
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); }