diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs
index 26840b1..1e517e1 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs
@@ -271,6 +271,7 @@ namespace ICSSoft.DataProject
sql = string.Format(sql, Identification);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt.Rows.Count > 1)
+
{
throw new Exception(language.GetNameByCode("WMSAPIInfo202"));//单次提交单据数量卡控(只允许一张单据)
}
@@ -492,28 +493,29 @@ namespace ICSSoft.DataProject
///
///
///
- public static void SalesReturnBackInERP(string TransType, string Identification, SqlCommand cmd, Dictionary language, string BusinessCode)
+ public static void SalesReturnBackInERP(string TransCode, string Identification, SqlCommand cmd, Dictionary language, string workPoint)
{
try
{
#region SAP(三层结构)
string IsSuccess = "";
string ErrorMessage = "";
- string sql = @" select Distinct A.SDNCode,A.WorkPoint from ICSSDN A
- LEFT JOIN ICSWareHouseLotInfoLog B ON B.TransCode=A.SDNCode AND B.WorkPoint=A.WorkPoint
- where B.Identification='{0}' AND BusinessCode='20'";
- sql = string.Format(sql, Identification);
- DataTable dt = DBHelper.SQlReturnData(sql, cmd);
- if (dt.Rows.Count > 1)
- {
- throw new Exception(language.GetNameByCode("WMSAPIInfo202"));//单次提交单据数量卡控(只允许一张单据)
- }
- for (int i = 0; i < dt.Rows.Count; i++)
- {
+ string sql = "";
+ //string sql = @" select Distinct A.SDNCode,A.WorkPoint from ICSSDN A
+ // LEFT JOIN ICSWareHouseLotInfoLog B ON B.TransCode=A.SDNCode AND B.WorkPoint=A.WorkPoint
+ // where B.Identification='{0}' AND BusinessCode='44'";
+ //sql = string.Format(sql, Identification);
+ //DataTable dt = DBHelper.SQlReturnData(sql, cmd);
+ //if (dt.Rows.Count > 1)
+ //{
+ // throw new Exception(language.GetNameByCode("WMSAPIInfo202"));//单次提交单据数量卡控(只允许一张单据)
+ //}
+ //for (int i = 0; i < dt.Rows.Count; i++)
+ //{
string chksql = @"select SUM(Quantity) AS Quantity,SUM(SDNQuantity) AS SDNQuantity from ICSSDN
where SDNCode='{0}' and WorkPoint='{1}'
GROUP BY SDNCode,WorkPoint";
- chksql = string.Format(chksql, dt.Rows[i]["SDNCode"].ToString(), dt.Rows[i]["WorkPoint"].ToString());
+ chksql = string.Format(chksql, TransCode, workPoint);
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) == Convert.ToDecimal(chkdt.Rows[0]["SDNQuantity"]))
{
@@ -521,7 +523,7 @@ namespace ICSSoft.DataProject
SAPCallBackDispatchVPN.ZWMS_SK_DO_GZ1 Info = new SAPCallBackDispatchVPN.ZWMS_SK_DO_GZ1();
List headlist = new List();
SAPCallBackDispatchVPN.ZWMS_DO_HEAD head = new SAPCallBackDispatchVPN.ZWMS_DO_HEAD();
- head.VBELN = dt.Rows[i]["SDNCode"].ToString();
+ head.VBELN = TransCode;
headlist.Add(head);
Info.T_HEAD = headlist.ToArray();
List ItemList = new List();
@@ -531,7 +533,7 @@ namespace ICSSoft.DataProject
,ISNULL(B.BatchCode,'') AS BatchCode from ICSSDN A
LEFT JOIN ICSExtension B ON B.ID=A.ExtensionID AND B.WorkPoint=A.WorkPoint
WHERE SDNCode='{0}' AND A.WorkPoint='{1}'";
- sql = string.Format(sql, dt.Rows[i]["SDNCode"].ToString(), dt.Rows[i]["WorkPoint"].ToString());
+ sql = string.Format(sql, TransCode, workPoint);
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd);
foreach (DataRow dr in Sapdt.Rows)
{
@@ -575,7 +577,7 @@ namespace ICSSoft.DataProject
}
}
}
- }
+ //}
if (IsSuccess == "N")
{
throw new Exception(ErrorMessage);
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
index e8f0fb7..3790d25 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
@@ -2740,6 +2740,15 @@ namespace ICSSoft.DataProject
ICSWareHouseLotInfoService.WareHouseLotInfoUp(Identification, itemInfo.LocationCode, itemInfo.LotNo, itemInfo.Quantity,
item.User, item.WorkPoint, WHTransType, BusinessCode, cmd, language, itemInfo.LogID, itemInfo.InvCode + itemInfo.WarehouseCode);
}
+
+ //上传ERP
+ if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
+ {
+ //销售退货-原条码
+ if (TransType == TransTypeEnum.SalesReturnBack.GetDescription())
+ ICSSalesService.SalesReturnBackInERP(itemInfo.TransCode, Identification, cmd, language, item.WorkPoint);
+ }
+
}
#region 拆卸单
@@ -2750,6 +2759,8 @@ namespace ICSSoft.DataProject
}
#endregion}
}
+
+
//上传ERP
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
{
@@ -2796,9 +2807,7 @@ namespace ICSSoft.DataProject
//两步调入
else if (TransType == TransTypeEnum.TwoStepTransferDocIn.GetDescription())
ICSWareHouseService.TwoStepTransferDocInERP(TransType, Identification, cmd, language, BusinessCode);
- //销售退货-原条码
- else if (TransType == TransTypeEnum.SalesReturnBack.GetDescription())
- ICSSalesService.SalesReturnBackInERP(TransType, Identification, cmd, language, BusinessCode);
+
//其他入库
else if (TransType == TransTypeEnum.OtherInDoc.GetDescription())
ICSWareHouseService.OtherInDocERP(TransType, Identification, cmd, language, BusinessCode);
@@ -5393,8 +5402,8 @@ namespace ICSSoft.DataProject
AND Sequence = '{item.TransSequence}'
AND WorkPoint = '{item.WorkPoint}'
AND Type = '{item.TransType}'";
- var workPoint=DBHelper.ExecuteScalar(checksql, cmd);
- if (workPoint == null)
+ var workPoint=DBHelper.ExecuteScalar(checksql, cmd).ToString();
+ if (workPoint == null|| workPoint=="")
{
tranferWorkpoint = item.WorkPoint;
}
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
index cff826b..0419b4b 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
@@ -1114,10 +1114,10 @@ namespace ICSSoft.DataProject
sql = @"INSERT INTO ICSInventoryLotDetail(LotNo,TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
SELECT '{0}',b.TransCode,b.TransSequence,f.F_Account ,f.F_RealName ,SYSDATETIME() ,'{1}'
FROM ICSInventoryLot a
- INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
+ INNER JOIN ICSInventoryLotDetail b ON b.LotNo='{3}' 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, lotstr, tranferWorkpoint, User);
+ sql = string.Format(sql, lotstr, tranferWorkpoint, User,LotNo);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{