diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs
index 8cfb07d..3e9b0da 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs
@@ -814,6 +814,33 @@ namespace ICSSoft.DataProject
throw;
}
}
+ ///
+ /// 采购退货(货柜)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void PurchaseReceiveDoctNegativeHG(string TransCode, string WorkPoint, SqlCommand cmd, Dictionary language)
+ {
+ try
+ {
+ string sql = @" UPDATE ICSDeliveryNotice SET RCVQuantity=Quantity
+ WHERE DNCode='{0}' AND WorkPoint='{1}'";
+
+ sql = string.Format(sql, TransCode, WorkPoint);
+
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo088"));//"采购退货单更新失败!");
+ }
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
///
/// 采购退货接口
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
index 0fd2f7f..8281bcf 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
@@ -2709,7 +2709,7 @@ namespace ICSSoft.DataProject
BusinessCode = TransTypeEnum.MOIssueDocNegative.GetDescription();
var getDate = $@"SELECT top 1 MTIME FROM ICSWareHouseLotInfo WHERE InvCode='{itemInfo.InvCode}' AND Quantity>0 ORDER BY MTIME ";
var date = DBHelper.ExecuteScalar(getDate, cmd);
- if (date != null || date.ToString() != "")
+ if (date != null)
{
createDate = Convert.ToDateTime(date).AddDays(-1);
}
@@ -3423,7 +3423,7 @@ namespace ICSSoft.DataProject
ICSPurchaseService.DeliveryNoticeInForHG(JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, cmd, language);
BusinessCode = TransTypeEnum.DeliveryNotice.GetDescription();
//生成条码的同时入库
- ICSWareHouseLotInfoService.WareHouseLotInfoUpForHG(Identification, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE,itemInfo.STO_HOSTINF
+ ICSWareHouseLotInfoService.WareHouseLotInfoUpForHG(Identification, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, itemInfo.STO_HOSTINF
, itemInfo.STO_EFF_ARTICOLO, itemInfo.STO_EFF_QTA,
itemInfo.STO_EXE_OPERATORE, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, itemInfo.STO_CORRIDOIO, "2", BusinessCode, cmd, language);
}
@@ -3464,14 +3464,11 @@ namespace ICSSoft.DataProject
{
BusinessCode = TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription();
- foreach (var itemInfo in JsonData.DATA.EXP_ORDINI_RIGHE_STO)
- {
- //更新源头单据数量
- ICSPurchaseService.PurchaseReceiveDoctNegative(JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, itemInfo.STO_HOSTINF, itemInfo.STO_EFF_QTA, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, cmd, language);
- //出库
- printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, itemInfo.STO_HOSTINF, itemInfo.STO_EFF_SUB1, itemInfo.STO_EFF_QTA,
- itemInfo.STO_EXE_OPERATORE, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, "3", TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription(), cmd, language);
- }
+ //更新源头单据数量
+ ICSPurchaseService.PurchaseReceiveDoctNegativeHG(JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, cmd, language);
+ //出库
+ printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDownHG(Identification, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, JsonData.DATA.EXP_ORDINI_RIGHE_STO[0].STO_EXE_OPERATORE
+ , JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, "3", TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription(), cmd, language);
}
#endregion
#region 领料申请单发料
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
index fc78c94..29691d9 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
@@ -978,6 +978,267 @@ namespace ICSSoft.DataProject
return lstDt;
}
+ ///
+ /// 减少库存(货柜)
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static DataTable WareHouseLotInfoDownHG(string Identification, string TransCode, string User,
+ string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary language, string MergeID = "")
+ {
+ String LotEnable = "";
+ String PrintEnable = "";
+ string lotstr = "";
+ int result = 0;
+ List NewBarCodeList = new List();
+ DataTable dtLotno = new DataTable();
+ DataTable lstDt = new DataTable();
+ try
+ {
+
+ ///更新库存
+ string sql = @"UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)-'{2}' WHERE LotNo='{0}' AND WorkPoint='{1}'
+
+ IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND Quantity<0)
+ BEGIN
+ RAISERROR('" + language.GetNameByCode("WMSAPIInfo167") + @"',16,1);
+ RETURN
+ END";
+ sql = string.Format(sql, LotNo, WorkPoint, Quantity);
+
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo168"));//"库存更新失败!");
+ }
+ //出库后取消占料
+ sql = @"update A SET A.LockQuantity-=B.Quantity FROM ICSWareHouseLotInfo A
+ LEFT JOIN ICSWareHouseLotInfoLog B ON B.LotNo=A.LotNo AND B.TransType='15' AND B.WorkPoint=A.WorkPoint
+ WHERE A.LotNo='{0}' AND B.TransCode='{1}' AND B.TransSequence='{2}' AND A.WorkPoint='{3}'
+ DELETE FROM ICSWareHouseLotInfoLog
+ WHERE LotNo='{0}' AND TransCode='{1}' AND TransSequence='{2}' AND WorkPoint='{3}' AND TransType='15'";
+ sql = string.Format(sql, LotNo, TransCode, TransSequence, WorkPoint);
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception("占料信息解除失败!");//"库存更新失败!");
+ }
+
+ //检验是否分批
+ sql = @"SELECT b.LotEnable,b.PrintEnable FROM ICSInventoryLot a
+ LEFT JOIN ICSInventory b ON a.InvCode=b.InvCode AND a.WorkPoint=b.WorkPoint
+ where a.LotNo='{0}' and a.WorkPoint='{1}'
+ ";
+ sql = string.Format(sql, LotNo, WorkPoint);
+ DataTable dt = DBHelper.SQlReturnData(sql, cmd);
+ if (dt.Rows.Count == 0)
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo369"));
+ }
+ else
+ {
+ LotEnable = dt.Rows[0]["LotEnable"].ToString();
+ PrintEnable = dt.Rows[0]["PrintEnable"].ToString();
+ }
+ if (LotEnable.Equals("True"))
+ {
+ ///分批前添加日志
+ sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
+ BEGIN
+ RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{2}") + @"',16,1);
+ RETURN
+ END
+
+ INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
+ FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
+ Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
+ ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
+ MTIME,WorkPoint,EATTRIBUTE1)
+ SELECT NEWID(),'{3}','{7}','{8}',a.LotNo ,a.InvCode ,
+ c.WarehouseCode,c.LocationCode,'','',c.Quantity+{6},
+ '','0','{4}','31','0','',
+ '','','',f.F_Account ,f.F_RealName ,
+ SYSDATETIME() ,a.WorkPoint ,''
+ FROM ICSInventoryLot a
+ INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
+ INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
+ INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
+ WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
+ ";
+ sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransType, BusinessCode, Quantity, TransCode, TransSequence);
+
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
+ }
+ #region 获取分批后的条码(lotstr)
+ sql = @"SELECT TOP 1 LotNO FROM ICSInventoryLot WHERE EATTRIBUTE1='{0}' AND WorkPoint='{1}'
+ ORDER BY CAST(SUBSTRING(LotNO, (LEN(LotNO)-CHARINDEX('-',REVERSE(LotNO))+1)+1,CHARINDEX('-',REVERSE(LotNO))-1) AS INT) DESC";
+ sql = string.Format(sql, LotNo, WorkPoint);
+ dt = DBHelper.SQlReturnData(sql, cmd);
+ if (dt.Rows.Count == 0)
+ {
+ lotstr = LotNo + "-" + 1;
+ }
+ else
+ {
+ lotstr = LotNo + "-" + (Convert.ToInt32(dt.Rows[0]["LotNO"].ToString().Split('-')[dt.Rows[0]["LotNO"].ToString().Split('-').Length - 1]) + 1).ToString();
+ }
+ NewBarCodeList.Add(lotstr);//将分批后新条码添加到新集合
+ #endregion
+
+ #region 将分批后的条码记录插入条码表,库存表及日志表并将原条码库存数量清零
+ sql = @"INSERT INTO ICSInventoryLot(ID,LotNo,InvCode,ProductDate,ExpirationDate,
+ Quantity,Amount,ExtensionID,Type,PrintTimes,
+ LastPrintUser,LastPrintTime,MUSER,MUSERName,MTIME,
+ WorkPoint,EATTRIBUTE1)
+ SELECT TOP 1 NEWID(),'{0}',a.InvCode,a.ProductDate,a.ExpirationDate,
+ '{2}',a.Amount,a.ExtensionID,a.Type,a.PrintTimes,
+ a.LastPrintUser,a.LastPrintTime,a.MUSER ,a.MUSERName ,GETDATE(),
+ a.WorkPoint ,'{1}'
+ From ICSInventoryLot a
+ where a.LotNo='{1}' and a.WorkPoint='{3}'";
+ sql = string.Format(sql, lotstr, LotNo, Quantity, WorkPoint);
+ cmd.CommandText = sql;
+ result = cmd.ExecuteNonQuery();
+ if (result <= 0)
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo195"));//条码分批后条码表存入失败!
+ }
+ sql = @"INSERT INTO ICSWareHouseLotInfo(ID,LotNO,WarehouseCode,LocationCode,InvCode,Quantity,InDate,LockQuantity,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1)
+ select NEWID(),'{0}',WarehouseCode,LocationCode,InvCode,'0',InDate,LockQuantity
+ ,MUSER,MUSERName,GETDATE(),'{3}',''
+ from ICSWareHouseLotInfo
+ where LotNO='{1}' AND WorkPoint='{3}'";
+ sql = string.Format(sql, lotstr, LotNo, Quantity, WorkPoint);
+ cmd.CommandText = sql;
+ result = cmd.ExecuteNonQuery();
+ if (result <= 0)
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo196"));//条码分批后库存表存入失败!
+ }
+ //插入条码单据表
+ sql = @"INSERT INTO ICSInventoryLotDetail(LotNo,TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
+ SELECT '{3}',b.TransCode,b.TransSequence,f.F_Account ,f.F_RealName ,SYSDATETIME() ,a.WorkPoint
+ FROM ICSInventoryLot a
+ INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
+ INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
+ WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'";
+ sql = string.Format(sql, LotNo, WorkPoint, User, lotstr);
+
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo174"));//"条码单据表写入失败!");
+ }
+ sql = @"INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
+ FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
+ Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
+ ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
+ MTIME,WorkPoint,EATTRIBUTE1,LogID)
+ SELECT NEWID(),'{3}','{4}','{5}','{10}' ,a.InvCode ,
+ c.WarehouseCode,c.LocationCode,'','','{6}',
+ '','0','{7}','{8}','0','',
+ '','','',f.F_Account ,f.F_RealName ,
+ SYSDATETIME() ,a.WorkPoint ,'','{9}'
+ FROM ICSInventoryLot a
+ INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
+ INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
+ WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
+ ";
+ sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, MergeID, lotstr);
+ cmd.CommandText = sql;
+ result = cmd.ExecuteNonQuery();
+ if (result <= 0)
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo197"));//条码分批后库存日志表存入失败!
+ }
+
+ if (PrintEnable.Equals("True"))
+ {
+ sql = @"select A.LotNO AS OLDLotNo , C.Quantity AS OLDLotQty, A.eattribute1 as LotNO, B.Quantity AS LotQty ,b.InvCode,d.INVSTD,d.INVNAME,b.MTIME,A.TransCode
+ from ICSWareHouseLotInfolog A
+ left join ICSInventoryLot B on A.LotNO=B.LotNO and a.WorkPoint=b.WorkPoint
+ left join ICSWareHouseLotInfo C ON A.LotNO=C.LotNO and a.WorkPoint=c.WorkPoint
+ left join ICSInventory D on b.INVCODE=d.INVCODE and b.WorkPoint=d.WorkPoint
+ where A.lotno like'{0}%' and a.workpoint='{1}'
+ ";
+ sql = string.Format(sql, LotNo, WorkPoint);
+ dtLotno = DBHelper.SQlReturnData(sql, cmd);
+ lstDt = dtLotno;
+ }
+
+ ///添加日志
+ sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
+ BEGIN
+ RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{2}") + @"',16,1);
+ RETURN
+ END
+
+ INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
+ FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
+ Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
+ ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
+ MTIME,WorkPoint,EATTRIBUTE1,MergeID)
+ SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode ,
+ c.WarehouseCode,c.LocationCode,'','',c.Quantity,
+ '','0','{7}','32','0','',
+ '','','',f.F_Account ,f.F_RealName ,
+ SYSDATETIME() ,a.WorkPoint ,'','{9}'
+ FROM ICSInventoryLot a
+ INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
+ INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
+ WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
+ ";
+ sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, MergeID);
+
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
+ }
+
+ #endregion
+ }
+ else
+ {
+ NewBarCodeList.Add(LotNo);
+
+ ///添加日志
+ sql = @"INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
+ FromWarehouseCode,FromLocationCode,ToWarehouseCode,ToLocationCode,Quantity,
+ Memo,Lock,TransType,BusinessCode,ERPUpload,ERPID,
+ ERPDetailID,ERPCode,ERPSequence,MUSER,MUSERName,
+ MTIME,WorkPoint,EATTRIBUTE1,MergeID)
+ SELECT NEWID(),'{3}','{4}','{5}',a.LotNo ,a.InvCode ,
+ c.WarehouseCode,c.LocationCode,'','','{6}',
+ '','0','{7}','{8}','0','',
+ '','','','{2}','{2}',
+ SYSDATETIME() ,a.WorkPoint ,'','{9}'
+ FROM ICSInventoryLot a
+ INNER JOIN ICSWareHouseLotInfo c ON a.LotNo=c.LotNo AND a.WorkPoint=c.WorkPoint
+ --INNER JOIN Sys_SRM_User f ON f.F_Account='{2}' AND a.WorkPoint=f.F_Location
+ WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
+ ";
+ sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransCode, TransSequence, Quantity, TransType, BusinessCode, MergeID);
+
+ if (!DBHelper.ExecuteNonQuery(sql, cmd))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
+ }
+ }
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ return lstDt;
+ }
+
///
/// 减少库存(无条码领料)
///
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config
index f291968..82e67eb 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config
@@ -7,9 +7,9 @@
-
+
-
+
diff --git a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
index 1978730..e6dc63b 100644
--- a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
+++ b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
@@ -1739,7 +1739,7 @@ a.Sequence,
#region 其它出库SQL
sqls = @" select
a.OutCode as Code,
-a.Sequence
+a.Sequence,
a.InvCode,
b.InvName,
b.InvStd,
@@ -1856,6 +1856,7 @@ c.Sequence,
{
if (i != 0
&& (!table.Rows[i]["InvCode"].ToString().Equals(table.Rows[i - 1]["InvCode"].ToString())
+ || !table.Rows[i]["Sequence"].ToString().Equals(table.Rows[i - 1]["Sequence"].ToString())
|| !table.Rows[i]["Code"].ToString().Equals(table.Rows[i - 1]["Code"].ToString())
|| !table.Rows[i]["ExtensionID"].ToString().Equals(table.Rows[i - 1]["ExtensionID"].ToString()))
)
@@ -1891,7 +1892,7 @@ c.Sequence,
}
}
}
- if (qtyCount >= orderQty)
+ if (qtyCount > orderQty)
{
table.Rows[i]["SendQTY"] = Convert.ToDecimal(lotQty) - (Convert.ToDecimal(qtyCount) - Convert.ToDecimal(orderQty));
remove = true;
@@ -1923,87 +1924,89 @@ c.Sequence,
var pikTbLogTime = DateTime.Now;
string pikTbLogsql = string.Empty;
List DocNoList = new List();
- string InspectJosn = "";
- string InspectJosnHead = "";
- string InspectJosnBody = "";
- InspectJosn += "{";
- InspectJosn += "\"IMP_ORDINI\":[";
- InspectJosn += "货柜主表区域预留";
- InspectJosn += "],";
- InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
- InspectJosn += "货柜子表区域预留";
- InspectJosn += "]";
- InspectJosn += "}";
- foreach (DataRow PickLog in table.Rows)
- {
- 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, PickLog["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(PickLog["Code"].ToString()))
- {
- DocNoList.Add(PickLog["Code"].ToString());
- }
- InspectJosnBody += "{";
- InspectJosnBody += "\"RIG_ORDINE\":\"" + PickLog["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\": " + PickLog["SendQTY"].ToString() + ",";
- InspectJosnBody += "\"RIG_HOSTINF\": \"" + PickLog["Sequence"].ToString() + "\"";
- 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.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 + "");
- }
- }
- }
+ #region 货柜
+ //string InspectJosn = "";
+ //string InspectJosnHead = "";
+ //string InspectJosnBody = "";
+ //InspectJosn += "{";
+ //InspectJosn += "\"IMP_ORDINI\":[";
+ //InspectJosn += "货柜主表区域预留";
+ //InspectJosn += "],";
+ //InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
+ //InspectJosn += "货柜子表区域预留";
+ //InspectJosn += "]";
+ //InspectJosn += "}";
+ //foreach (DataRow PickLog in table.Rows)
+ //{
+ // 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, PickLog["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(PickLog["Code"].ToString()))
+ // {
+ // DocNoList.Add(PickLog["Code"].ToString());
+ // }
+ // InspectJosnBody += "{";
+ // InspectJosnBody += "\"RIG_ORDINE\":\"" + PickLog["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\": " + PickLog["SendQTY"].ToString() + ",";
+ // InspectJosnBody += "\"RIG_HOSTINF\": \"" + PickLog["Sequence"].ToString() + "\"";
+ // 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.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
foreach (DataRow PickLog in table.Rows)
{
pikTbLogsql += @"INSERT INTO ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,
diff --git a/WMS-BS/NFine.Application/WMS/WMSCreateItemLotApp.cs b/WMS-BS/NFine.Application/WMS/WMSCreateItemLotApp.cs
index 6c1f501..2141398 100644
--- a/WMS-BS/NFine.Application/WMS/WMSCreateItemLotApp.cs
+++ b/WMS-BS/NFine.Application/WMS/WMSCreateItemLotApp.cs
@@ -1414,7 +1414,7 @@ insert into ICSInventoryLot
{
try
{
- //string postUrlStr = System.Configuration.ConfigurationManager.AppSettings["HGDocpostUrlStr"].ToString();
+ string postUrlStr = System.Configuration.ConfigurationManager.AppSettings["HGDocpostUrlStr"].ToString();
var queryParam = keyValue.ToJObject();
string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
int createPageCount = Convert.ToInt32(queryParam["createPageCount"].ToString());
@@ -1428,18 +1428,18 @@ insert into ICSInventoryLot
string PRODUCTDATE = queryParam["PRODUCTDATE"].ToString();
string sqls = string.Empty;
string Colspan = "";
- //string InspectJosn = "";
- //InspectJosn += "{";
- //InspectJosn += "\"IMP_ORDINI\":[";
- //InspectJosn += "{";
- //InspectJosn += "\"ORD_ORDINE\":\"" + DNCode + "\",";
- //InspectJosn += "货柜区域预留";
- //InspectJosn += "\"ORD_DES\":\"采购入库-采购到货单\",";
- //InspectJosn += "\"ORD_TIPOOP\":\"V\",";
- //InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\"";
- //InspectJosn += "}";
- //InspectJosn += "],";
- //InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
+ string InspectJosn = "";
+ InspectJosn += "{";
+ InspectJosn += "\"IMP_ORDINI\":[";
+ InspectJosn += "{";
+ InspectJosn += "\"ORD_ORDINE\":\"" + DNCode + "\",";
+ InspectJosn += "货柜区域预留";
+ InspectJosn += "\"ORD_DES\":\"采购入库-采购到货单\",";
+ InspectJosn += "\"ORD_TIPOOP\":\"V\",";
+ InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\"";
+ InspectJosn += "}";
+ InspectJosn += "],";
+ InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
for (int i = 0; i < createPageCount; i++)
{
@@ -1479,82 +1479,82 @@ insert into ICSInventoryLot
LotNo, PRODUCTDATE, LOTQTY, MUSER, MUSERNAME, WorkPoints, DNCode, Sequence, ExtensionID, Convert.ToDecimal(queryParam["Amount"].ToString()) / minPackQty * LOTQTY, queryParam["ExpirationDate"].ToString());
sql += "\r\n";
- //if (i == createPageCount - 1)
- //{
- // InspectJosn += "{";
- // InspectJosn += "\"RIG_ORDINE\":\"" + DNCode + "\",";
- // InspectJosn += "\"RIG_ARTICOLO\": \"" + INVCode + "\",";
- // InspectJosn += "\"RIG_SUB1\": \"" + LotNo + "\",";
- // InspectJosn += "\"RIG_SUB2\": \"\",";
- // //InspectJosn += "\"RIG_OPERATORE_ASSEGNATO\": \"" + 20220968 + "\",";
- // InspectJosn += "\"RIG_QTAR\": " + LOTQTY + ",";
- // InspectJosn += "\"RIG_HOSTINF\": " + Sequence + "";
- // InspectJosn += "}";
- //}
- //else
- //{
- // InspectJosn += "{";
- // InspectJosn += "\"RIG_ORDINE\":\"" + DNCode + "\",";
- // InspectJosn += "\"RIG_ARTICOLO\": \"" + INVCode + "\",";
- // InspectJosn += "\"RIG_SUB1\": \"" + LotNo + "\",";
- // InspectJosn += "\"RIG_SUB2\": \"\",";
- // //InspectJosn += "\"RIG_OPERATORE_ASSEGNATO\": \"" + 20220968 + "\",";
- // InspectJosn += "\"RIG_QTAR\": " + LOTQTY + ",";
- // InspectJosn += "\"RIG_HOSTINF\": " + Sequence + "";
- // InspectJosn += "},";
- //}
- }
-
- //InspectJosn += "]";
- //InspectJosn += "}";
- //string result = "";
- //#region 验证物料对应仓储区域,非货柜区域不调用接口向货柜传输数据
- //string LocationCode = "";
- //string InvWHCode = "";
- //string chksql = @"select LocationCode,WHCode from ICSInventoryDetail
- // where INVCode='{0}' and WHCode=(
- // select WHCode from ICSDeliveryNotice
- // where DNCode='{1}' and Sequence='{2}' and WorkPoint='{3}')";
- //chksql = string.Format(chksql, INVCode, DNCode, Sequence, WorkPoint);
- //DataTable chkdt = SqlHelper.GetDataTableBySql(chksql);
- //if (chkdt.Rows.Count == 0)
- //{
- // throw new Exception("当前选中行物料在对应库存地点没有维护有效的区域,无法生成条码,请确认!");
- //}
- //else
- //{
- // LocationCode = chkdt.Rows[0]["LocationCode"].ToString();
- // InvWHCode = chkdt.Rows[0]["WHCode"].ToString();
- // chksql = @"select F_Id from Sys_SRM_ItemsDetail
- // where F_Define3='HGAreaConfig' AND F_Define1='{0}' AND F_Define2='{1}' and F_Define4='{2}'";
- // chksql = string.Format(chksql, InvWHCode, LocationCode, WorkPoint);
- // chkdt = SqlHelper.GetDataTableBySql(chksql);
- //}
- //#endregion
- //if (chkdt.Rows.Count > 0 && Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
- //{
- // #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
- // InspectJosn = InspectJosn.Replace("货柜区域预留", "\"ORD_ELEAREE\":\"" + LocationCode + "\",");
- // result = HTTPHelper.RestFulGet(InspectJosn, postUrlStr);
- // #region 货柜接口调用后日志
- // logsql = @"update ICSWMS_HGLog set ReturnResult='{0}'
- // where ID='{1}'";
- // logsql = string.Format(logsql, result, logID);
- // SqlHelper.CmdExecuteNonQueryLi(logsql);
- // #endregion
- // if (!result.Contains("successo"))
- // {
- // ICSHGResult hgresult = JsonConvert.DeserializeObject(result.TrimStart('[').TrimEnd(']'));
- // throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + "");
- // }
- //}
+ if (i == createPageCount - 1)
+ {
+ InspectJosn += "{";
+ InspectJosn += "\"RIG_ORDINE\":\"" + DNCode + "\",";
+ InspectJosn += "\"RIG_ARTICOLO\": \"" + INVCode + "\",";
+ InspectJosn += "\"RIG_SUB1\": \"" + LotNo + "\",";
+ InspectJosn += "\"RIG_SUB2\": \"\",";
+ //InspectJosn += "\"RIG_OPERATORE_ASSEGNATO\": \"" + 20220968 + "\",";
+ InspectJosn += "\"RIG_QTAR\": " + LOTQTY + ",";
+ InspectJosn += "\"RIG_HOSTINF\": " + Sequence + "";
+ InspectJosn += "}";
+ }
+ else
+ {
+ InspectJosn += "{";
+ InspectJosn += "\"RIG_ORDINE\":\"" + DNCode + "\",";
+ InspectJosn += "\"RIG_ARTICOLO\": \"" + INVCode + "\",";
+ InspectJosn += "\"RIG_SUB1\": \"" + LotNo + "\",";
+ InspectJosn += "\"RIG_SUB2\": \"\",";
+ //InspectJosn += "\"RIG_OPERATORE_ASSEGNATO\": \"" + 20220968 + "\",";
+ InspectJosn += "\"RIG_QTAR\": " + LOTQTY + ",";
+ InspectJosn += "\"RIG_HOSTINF\": " + Sequence + "";
+ InspectJosn += "},";
+ }
+ }
+
+ InspectJosn += "]";
+ InspectJosn += "}";
+ string result = "";
+ #region 验证物料对应仓储区域,非货柜区域不调用接口向货柜传输数据
+ string LocationCode = "";
+ string InvWHCode = "";
+ string chksql = @"select LocationCode,WHCode from ICSInventoryDetail
+ where INVCode='{0}' and WHCode=(
+ select WHCode from ICSDeliveryNotice
+ where DNCode='{1}' and Sequence='{2}' and WorkPoint='{3}')";
+ chksql = string.Format(chksql, INVCode, DNCode, Sequence, WorkPoint);
+ DataTable chkdt = SqlHelper.GetDataTableBySql(chksql);
+ if (chkdt.Rows.Count == 0)
+ {
+ throw new Exception("当前选中行物料在对应库存地点没有维护有效的区域,无法生成条码,请确认!");
+ }
+ else
+ {
+ LocationCode = chkdt.Rows[0]["LocationCode"].ToString();
+ InvWHCode = chkdt.Rows[0]["WHCode"].ToString();
+ chksql = @"select F_Id from Sys_SRM_ItemsDetail
+ where F_Define3='HGAreaConfig' AND F_Define1='{0}' AND F_Define2='{1}' and F_Define4='{2}'";
+ chksql = string.Format(chksql, InvWHCode, LocationCode, WorkPoint);
+ chkdt = SqlHelper.GetDataTableBySql(chksql);
+ }
+ #endregion
+ if (chkdt.Rows.Count > 0 && Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
+ {
+ #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
+ InspectJosn = InspectJosn.Replace("货柜区域预留", "\"ORD_ELEAREE\":\"" + LocationCode + "\",");
+ result = HTTPHelper.RestFulGet(InspectJosn, postUrlStr);
+ #region 货柜接口调用后日志
+ logsql = @"update ICSWMS_HGLog set ReturnResult='{0}'
+ where ID='{1}'";
+ logsql = string.Format(logsql, result, logID);
+ SqlHelper.CmdExecuteNonQueryLi(logsql);
+ #endregion
+ if (!result.Contains("successo"))
+ {
+ ICSHGResult hgresult = JsonConvert.DeserializeObject(result.TrimStart('[').TrimEnd(']'));
+ throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + "");
+ }
+ }
int count = SqlHelper.CmdExecuteNonQueryLi(sql);
return count;
}