diff --git a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs index 72dffd0..54f3738 100644 --- a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs +++ b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs @@ -2067,104 +2067,104 @@ c.Sequence, if (Type == "2" || Type == "12" || Type == "5") { #region 货柜 - //string InspectJosn = ""; - //string InspectJosnHead = ""; - //string InspectJosnBody = ""; - //InspectJosn += "{"; - //InspectJosn += "\"IMP_ORDINI\":["; - //InspectJosn += "货柜主表区域预留"; - //InspectJosn += "],"; - //InspectJosn += "\"IMP_ORDINI_RIGHE\":["; - //InspectJosn += "货柜子表区域预留"; - //InspectJosn += "]"; - //InspectJosn += "}"; - //for (int i = 0; i < table.Rows.Count; i++) - //{ - // string hgsql = @"select A.InvCode,A.LocationCode,B.F_Define3,C.LocationCode AS Area - // from ICSWareHouseLotInfo A - // INNER JOIN Sys_SRM_ItemsDetail B ON B.F_Define2=A.LocationCode AND F_Define4=A.WorkPoint AND F_ItemName='HG_Location' - // INNER JOIN ICSInventoryDetail C ON C.INVCode=A.InvCode AND C.WHCode=A.WarehouseCode AND C.WorkPoint=A.WorkPoint - // where A.LotNo='{0}' AND A.WorkPoint='{1}'"; - // hgsql = string.Format(hgsql, table.Rows[i]["LotNO"].ToString(), WorkPoint); - // var hgds = Repository().FindDataSetBySql(hgsql); - // if (hgds.Tables.Count == 0) - // return null; - // DataTable hgtable = hgds.Tables[0]; - // if (hgtable.Rows.Count > 0) - // { - // if (!DocNoList.Contains(table.Rows[i]["Code"].ToString())) - // { - // DocNoList.Add(table.Rows[i]["Code"].ToString()); - // } - // InspectJosnBody += "{"; - // InspectJosnBody += "\"RIG_ORDINE\":\"" + table.Rows[i]["Code"].ToString() + "\","; - // InspectJosnBody += "\"RIG_ARTICOLO\": \"" + hgtable.Rows[0]["InvCode"].ToString() + "\","; - // InspectJosnBody += "\"RIG_SUB1\": \"\","; - // InspectJosnBody += "\"RIG_SUB2\": \"\","; - // InspectJosnBody += "\"RIG_ELERUOLI_GEST\": \"" + hgtable.Rows[0]["Area"].ToString() + "\","; - // InspectJosnBody += "\"RIG_ELEBAIE\": \"" + hgtable.Rows[0]["F_Define3"].ToString() + "\","; - // InspectJosnBody += "\"RIG_QTAR\": " + table.Rows[i]["SendQTY"].ToString() + ","; - // if (i == 0) - // { - // InspectJosnBody += "\"RIG_HOSTINF\": \"" + table.Rows[i]["Sequence"].ToString() + "\""; - // } - // else - // { - // if (table.Rows[i]["Code"].ToString() == table.Rows[i - 1]["Code"].ToString() && - // table.Rows[i]["Sequence"].ToString() == table.Rows[i - 1]["Sequence"].ToString()) - // { - // InspectJosnBody += "\"RIG_HOSTINF\": \"" + table.Rows[i]["Sequence"].ToString() + Count.ToString() + "\""; - // Count++; - // } - // else - // { - // InspectJosnBody += "\"RIG_HOSTINF\": \"" + table.Rows[i]["Sequence"].ToString() + "\""; - // Count = 1; - // } - // } - // InspectJosnBody += "},"; - // } - //} - //InspectJosnBody = InspectJosnBody.TrimEnd(','); - //foreach (string DocNo in DocNoList) - //{ - // InspectJosnHead += "{"; - // InspectJosnHead += "\"ORD_ORDINE\":\"" + DocNo.TrimStart('\'').TrimEnd('\'') + "\","; - // InspectJosnHead += "\"ORD_DES\":\"" + TransType + "\","; - // InspectJosnHead += "\"ORD_TIPOOP\":\"P\","; - // InspectJosnHead += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; - // InspectJosnHead += "},"; - //} - //InspectJosnHead = InspectJosnHead.TrimEnd(','); - //if (InspectJosnBody != "") - //{ - // InspectJosn = InspectJosn.Replace("货柜主表区域预留", InspectJosnHead); - // InspectJosn = InspectJosn.Replace("货柜子表区域预留", InspectJosnBody); - // if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"])) - // { - // string callresult = ""; - // #region 货柜接口调用前日志 - // object logID = Guid.NewGuid(); - // string logsql = @"insert into ICSWMS_HGLog - // values - // ('{0}',GETDATE(),'{1}','{2}','{3}','{4}','{5}')"; - // logsql = string.Format(logsql, logID, InspectJosn, "", WorkPoint, MUSER, MUSERNAME); - // SqlHelper.CmdExecuteNonQueryLi(logsql); - // #endregion - // callresult = HTTPHelper.RestFulGet(InspectJosn, postUrlStr); - // #region 货柜接口调用后日志 - // logsql = @"update ICSWMS_HGLog set ReturnResult='{0}' - // where ID='{1}'"; - // logsql = string.Format(logsql, callresult, logID); - // SqlHelper.CmdExecuteNonQueryLi(logsql); - // #endregion - // //if (!callresult.Contains("successo")) - // //{ - // // ICSHGResult hgresult = JsonConvert.DeserializeObject(callresult.TrimStart('[').TrimEnd(']')); - // // throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + ""); - // //} - // } - //} + string InspectJosn = ""; + string InspectJosnHead = ""; + string InspectJosnBody = ""; + InspectJosn += "{"; + InspectJosn += "\"IMP_ORDINI\":["; + InspectJosn += "货柜主表区域预留"; + InspectJosn += "],"; + InspectJosn += "\"IMP_ORDINI_RIGHE\":["; + InspectJosn += "货柜子表区域预留"; + InspectJosn += "]"; + InspectJosn += "}"; + for (int i = 0; i < table.Rows.Count; i++) + { + string hgsql = @"select A.InvCode,A.LocationCode,B.F_Define3,C.LocationCode AS Area + from ICSWareHouseLotInfo A + INNER JOIN Sys_SRM_ItemsDetail B ON B.F_Define2=A.LocationCode AND F_Define4=A.WorkPoint AND F_ItemName='HG_Location' + INNER JOIN ICSInventoryDetail C ON C.INVCode=A.InvCode AND C.WHCode=A.WarehouseCode AND C.WorkPoint=A.WorkPoint + where A.LotNo='{0}' AND A.WorkPoint='{1}'"; + hgsql = string.Format(hgsql, table.Rows[i]["LotNO"].ToString(), WorkPoint); + var hgds = Repository().FindDataSetBySql(hgsql); + if (hgds.Tables.Count == 0) + return null; + DataTable hgtable = hgds.Tables[0]; + if (hgtable.Rows.Count > 0) + { + if (!DocNoList.Contains(table.Rows[i]["Code"].ToString())) + { + DocNoList.Add(table.Rows[i]["Code"].ToString()); + } + InspectJosnBody += "{"; + InspectJosnBody += "\"RIG_ORDINE\":\"" + table.Rows[i]["Code"].ToString() + "\","; + InspectJosnBody += "\"RIG_ARTICOLO\": \"" + hgtable.Rows[0]["InvCode"].ToString() + "\","; + InspectJosnBody += "\"RIG_SUB1\": \"\","; + InspectJosnBody += "\"RIG_SUB2\": \"\","; + InspectJosnBody += "\"RIG_ELERUOLI_GEST\": \"" + hgtable.Rows[0]["Area"].ToString() + "\","; + InspectJosnBody += "\"RIG_ELEBAIE\": \"" + hgtable.Rows[0]["F_Define3"].ToString() + "\","; + InspectJosnBody += "\"RIG_QTAR\": " + table.Rows[i]["SendQTY"].ToString() + ","; + if (i == 0) + { + InspectJosnBody += "\"RIG_HOSTINF\": \"" + table.Rows[i]["Sequence"].ToString() + "\""; + } + else + { + if (table.Rows[i]["Code"].ToString() == table.Rows[i - 1]["Code"].ToString() && + table.Rows[i]["Sequence"].ToString() == table.Rows[i - 1]["Sequence"].ToString()) + { + InspectJosnBody += "\"RIG_HOSTINF\": \"" + table.Rows[i]["Sequence"].ToString() + Count.ToString() + "\""; + Count++; + } + else + { + InspectJosnBody += "\"RIG_HOSTINF\": \"" + table.Rows[i]["Sequence"].ToString() + "\""; + Count = 1; + } + } + InspectJosnBody += "},"; + } + } + InspectJosnBody = InspectJosnBody.TrimEnd(','); + foreach (string DocNo in DocNoList) + { + InspectJosnHead += "{"; + InspectJosnHead += "\"ORD_ORDINE\":\"" + DocNo.TrimStart('\'').TrimEnd('\'') + "\","; + InspectJosnHead += "\"ORD_DES\":\"" + TransType + "\","; + InspectJosnHead += "\"ORD_TIPOOP\":\"P\","; + InspectJosnHead += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; + InspectJosnHead += "},"; + } + InspectJosnHead = InspectJosnHead.TrimEnd(','); + if (InspectJosnBody != "") + { + InspectJosn = InspectJosn.Replace("货柜主表区域预留", InspectJosnHead); + InspectJosn = InspectJosn.Replace("货柜子表区域预留", InspectJosnBody); + if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"])) + { + string callresult = ""; + #region 货柜接口调用前日志 + object logID = Guid.NewGuid(); + string logsql = @"insert into ICSWMS_HGLog + values + ('{0}',GETDATE(),'{1}','{2}','{3}','{4}','{5}')"; + logsql = string.Format(logsql, logID, InspectJosn, "", WorkPoint, MUSER, MUSERNAME); + SqlHelper.CmdExecuteNonQueryLi(logsql); + #endregion + callresult = HTTPHelper.RestFulGet(InspectJosn, postUrlStr); + #region 货柜接口调用后日志 + logsql = @"update ICSWMS_HGLog set ReturnResult='{0}' + where ID='{1}'"; + logsql = string.Format(logsql, callresult, logID); + SqlHelper.CmdExecuteNonQueryLi(logsql); + #endregion + //if (!callresult.Contains("successo")) + //{ + // ICSHGResult hgresult = JsonConvert.DeserializeObject(callresult.TrimStart('[').TrimEnd(']')); + // throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + ""); + //} + } + } #endregion } // sql += string.Format(@" update b set b.LockQuantity=convert(decimal(18,6),b.LockQuantity)-convert(decimal(18,6),c.Quantity )