Browse Source

叉车出库相关修改

master
陆晔 1 year ago
parent
commit
41a8f953b5
  1. 28
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  2. 345
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
  3. 2
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs

28
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs

@ -3430,7 +3430,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in JsonData.DATA.EXP_ORDINI_RIGHE_STO)
{
//更新源头单据数量
ICSPurchaseService.DeliveryNoticeInForHG(JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, itemInfo.STO_HOSTINF, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, cmd, language,itemInfo.STO_EFF_QTA);
ICSPurchaseService.DeliveryNoticeInForHG(JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, itemInfo.STO_HOSTINF, JsonData.DATA.EXP_ORDINI[0].ORD_CLIENTE, cmd, language, itemInfo.STO_EFF_QTA);
BusinessCode = TransTypeEnum.DeliveryNotice.GetDescription<DBValue>();
//生成条码的同时入库
ICSWareHouseLotInfoService.WareHouseLotInfoUpForHG(Identification, JsonData.DATA.EXP_ORDINI[0].ORD_ORDINE, itemInfo.STO_HOSTINF
@ -5891,7 +5891,7 @@ namespace ICSSoft.DataProject
RAISERROR('{3}',16,1);
RETURN
END";
sql = string.Format(sql, item.WarehouseCode, item.WorkPoint, item.LocationCode, errorMessage,item.LotNo);
sql = string.Format(sql, item.WarehouseCode, item.WorkPoint, item.LocationCode, errorMessage, item.LotNo);
DBHelper.ExecuteNonQuery(sql, cmd);
//更新条码信息
@ -7113,10 +7113,10 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
//获取第一个数据的料架编码
string fistContainerCode = JsonData.FirstOrDefault().ContainerCode;
//获取第一个条码数据
string fistLotNO= JsonData.FirstOrDefault().LotNo;
//查询第一个条码的仓库和库位信息
var tableData=ICSWareHouseLotInfoService.GetWHCodeArea(fistLotNO, cmd);
if (tableData.Rows.Count==0)
string fistLotNO = JsonData.FirstOrDefault().LotNo;
//查询第一个条码的仓库和库位信息
var tableData = ICSWareHouseLotInfoService.GetWHCodeArea(fistLotNO, cmd);
if (tableData.Rows.Count == 0)
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo038"), fistLotNO));
}
@ -7148,7 +7148,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo206"));//"位置编码不能为空!"
}
if (item.ContainerCode!=fistContainerCode)
if (item.ContainerCode != fistContainerCode)
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo474"));//"所传的料架编码不一致,调用失败!"
}
@ -7167,7 +7167,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo038"), item.LotNo));
}
else if (tableModel.Rows[0]["WHCode"].ToString()!= tableData.Rows[0]["WHCode"].ToString())
else if (tableModel.Rows[0]["WHCode"].ToString() != tableData.Rows[0]["WHCode"].ToString())
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo475"), item.LotNo));
}
@ -7250,7 +7250,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo197"));//"料架不能为空!"
}
if (item.TransCode.Count<=0)
if (item.TransCode.Count <= 0)
{
msg = language.GetNameByCode("WMSAPIInfo001");//单据为空
}
@ -7261,8 +7261,8 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
return res;
}
//料架单据绑定
ICSWareHouseLotInfoService.ContainerTransCodeBind(item.TransCode, item.ContainerCode, item.User, cmd, language);
//料架单据绑定
ICSWareHouseLotInfoService.ContainerTransCodeBind(item.TransCode, item.ContainerCode, item.User, cmd, language);
}
res.Success = true;
res.Message = msg;// "接口调用成功!";
@ -7614,7 +7614,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
}
#endregion
#region 叉车搬运结束后回调(入库)
#region 叉车搬运结束后回调(入库:PTWY上架 出库:PICK出库
public static ForkLiftResult ForkLiftTaskEndIn(ForkLiftCallBackModel JsonData, string Jsonstr)
{
var language = LanguageHelper.GetName("WMSAPIInfo");
@ -7653,7 +7653,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
}
else
{
ICSWareHouseLotInfoService.ActionForkLiftTaskEnd(JsonData.TaskID, cmd, language);
ICSWareHouseLotInfoService.ActionForkLiftTaskEnd(JsonData.TaskID, JsonData.TaskType, JsonData.DestBin, cmd, language);
}
res.Ret = 1;
res.RetMsg = "success";// "接口调用成功!";
@ -8424,7 +8424,7 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
if (!string.IsNullOrEmpty(JsonData.INVCode))
{
string strInvCode = "";
string[] InvCodeList= JsonData.INVCode.Split(',');
string[] InvCodeList = JsonData.INVCode.Split(',');
foreach (string INVCode in InvCodeList)
{
if (strInvCode == "")

345
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

@ -3489,37 +3489,41 @@ namespace ICSSoft.DataProject
/// <param name="TaskID"></param>
/// <param name="cmd"></param>
/// <param name="language"></param>
public static void ActionForkLiftTaskEnd(string TaskID, SqlCommand cmd, Dictionary<string, string> language)
public static void ActionForkLiftTaskEnd(string TaskID, string TaskType, string DestBin, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
#region 获取任务ID相关的料架条码及目标库位信息
string ContainerCode = "";
string StartLocation = "";
string EndLocation = "";
string sql = @"select ContainerCode,StartLocation,EndLocation from ICSForkLiftTaskLog
where TaskCode='{0}'";
sql = string.Format(sql, TaskID);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt.Rows.Count == 0)
{
throw new Exception("任务ID:" + TaskID + ",未查询到相关任务记录,无法入库!");
}
else
if (TaskType == "PTWY上架")
{
ContainerCode = dt.Rows[0]["ContainerCode"].ToString();
StartLocation = dt.Rows[0]["StartLocation"].ToString();
EndLocation = dt.Rows[0]["EndLocation"].ToString();
}
#endregion
#region 入库
#region 根据条码获取入库单据信息
string chksql = @"select COUNT(B.LotNo) AS LotCount from ICSContainer A
#region 获取任务ID相关的料架条码及目标库位信息
string ContainerCode = "";
string StartLocation = "";
string EndLocation = "";
string sql = @"select ContainerCode,StartLocation,EndLocation from ICSForkLiftTaskLog
where TaskCode='{0}'";
sql = string.Format(sql, TaskID);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt.Rows.Count == 0)
{
throw new Exception("任务ID:" + TaskID + ",未查询到相关任务记录,无法入库!");
}
else
{
ContainerCode = dt.Rows[0]["ContainerCode"].ToString();
StartLocation = dt.Rows[0]["StartLocation"].ToString();
EndLocation = dt.Rows[0]["EndLocation"].ToString();
}
#endregion
#region 根据条码获取入库单据信息
string chksql = @"select COUNT(B.LotNo) AS LotCount from ICSContainer A
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint
WHERE ContainerCode='{0}'";
chksql = string.Format(chksql, ContainerCode);
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd);
sql = @"select E.DNCode AS TransNO,E.Sequence AS TransLine,C.LotNo,C.Quantity,'采购入库' AS DocType
chksql = string.Format(chksql, ContainerCode);
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd);
sql = @"select E.DNCode AS TransNO,E.Sequence AS TransLine,C.LotNo,C.Quantity,'采购入库' AS DocType
,A.WorkPoint,C.InvCode from ICSContainer A
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint
INNER JOIN ICSInventoryLot C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint
@ -3534,44 +3538,44 @@ namespace ICSSoft.DataProject
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint
INNER JOIN ICSMOApplyNegDetail E ON E.ApplyNegCode=D.TransCode AND E.Sequence=D.TransSequence AND E.WorkPoint=D.WorkPoint
where A.ContainerCode='{0}'";
sql = string.Format(sql, ContainerCode);
dt = DBHelper.SQlReturnData(sql, cmd);
if (chkdt.Rows.Count != dt.Rows.Count)
{
throw new Exception("料架:" + ContainerCode + ",绑定条码的数量与实际查到的条码单据关联数据不符,请确认条码信息!");
}
#endregion
else
{
#region WMS入库
string Identification = Guid.NewGuid().ToString();
string BusinessCode = string.Empty;
foreach (DataRow dr in dt.Rows)
sql = string.Format(sql, ContainerCode);
dt = DBHelper.SQlReturnData(sql, cmd);
if (chkdt.Rows.Count != dt.Rows.Count)
{
if (dr["DocType"].ToString() == "采购入库")
{
#region 采购入库
ICSPurchaseService.DeliveryNoticeIn(dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language);
BusinessCode = TransTypeEnum.DeliveryNotice.GetDescription<DBValue>();
#endregion
}
else
throw new Exception("料架:" + ContainerCode + ",绑定条码的数量与实际查到的条码单据关联数据不符,请确认条码信息!");
}
#endregion
else
{
#region WMS入库
string Identification = Guid.NewGuid().ToString();
string BusinessCode = string.Empty;
foreach (DataRow dr in dt.Rows)
{
#region 生产退料入库
ICSManufactureService.MOIssueDocNegative(TransTypeEnum.MOIssueDocNegativeApply.GetDescription()
, "", dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language);
BusinessCode = TransTypeEnum.MOIssueDocNegative.GetDescription<DBValue>();
#endregion
if (dr["DocType"].ToString() == "采购入库")
{
#region 采购入库
ICSPurchaseService.DeliveryNoticeIn(dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language);
BusinessCode = TransTypeEnum.DeliveryNotice.GetDescription<DBValue>();
#endregion
}
else
{
#region 生产退料入库
ICSManufactureService.MOIssueDocNegative(TransTypeEnum.MOIssueDocNegativeApply.GetDescription()
, "", dr["LotNo"].ToString(), dr["Quantity"].ToString(), dr["WorkPoint"].ToString(), cmd, language);
BusinessCode = TransTypeEnum.MOIssueDocNegative.GetDescription<DBValue>();
#endregion
}
WareHouseLotInfoUp(Identification, EndLocation, dr["LotNo"].ToString(), dr["Quantity"].ToString(),
"ForkLift", dr["WorkPoint"].ToString(), "2", BusinessCode
, cmd, language, "", dr["InvCode"].ToString() + EndLocation.Split('-')[0].ToString()
, DateTime.Now.ToString());
}
WareHouseLotInfoUp(Identification, EndLocation, dr["LotNo"].ToString(), dr["Quantity"].ToString(),
"ForkLift", dr["WorkPoint"].ToString(), "2", BusinessCode
, cmd, language, "", dr["InvCode"].ToString() + EndLocation.Split('-')[0].ToString()
, DateTime.Now.ToString());
#endregion
}
#endregion
}
#region 判断单据是否全部完成入库,并过账SAP
string docsql = @"select DISTINCT E.DNCode AS TransNO,'采购入库' AS DocType,A.WorkPoint from ICSContainer A
#region 判断单据是否全部完成入库,并过账SAP
string docsql = @"select DISTINCT E.DNCode AS TransNO,'采购入库' AS DocType,A.WorkPoint from ICSContainer A
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint
INNER JOIN ICSInventoryLot C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint
@ -3584,134 +3588,151 @@ namespace ICSSoft.DataProject
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint
INNER JOIN ICSMOApplyNegDetail E ON E.ApplyNegCode=D.TransCode AND E.Sequence=D.TransSequence AND E.WorkPoint=D.WorkPoint
where A.ContainerCode='{0}'";
docsql = string.Format(docsql, ContainerCode);
DataTable docdt = DBHelper.SQlReturnData(sql, cmd);
foreach (DataRow dr in docdt.Rows)
{
if (dr["DocType"].ToString() == "采购入库")
docsql = string.Format(docsql, ContainerCode);
DataTable docdt = DBHelper.SQlReturnData(sql, cmd);
foreach (DataRow dr in docdt.Rows)
{
#region 检验合格单过账SAP(检验合格单为两层结构 一行对应一个序列号)
chksql = @"select SUM(Quantity) AS Quantity,SUM(RCVQuantity) AS RCVQuantity from ICSDeliveryNotice
if (dr["DocType"].ToString() == "采购入库")
{
#region 检验合格单过账SAP(检验合格单为两层结构 一行对应一个序列号)
chksql = @"select SUM(Quantity) AS Quantity,SUM(RCVQuantity) AS RCVQuantity from ICSDeliveryNotice
where DNCode='{0}' and WorkPoint='{1}'
GROUP BY DNCode,WorkPoint";
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) != Convert.ToDecimal(chkdt.Rows[0]["RCVQuantity"]))
{
continue;
}
sql = @"select A.DNCode,
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) != Convert.ToDecimal(chkdt.Rows[0]["RCVQuantity"]))
{
continue;
}
sql = @"select A.DNCode,
CASE WHEN SUM(Convert(decimal(18,6),A.SAPSequence)) IS NULL THEN SUM(A.RCVQuantity)
ELSE SUM(Convert(decimal(18,6),A.SAPSequence)) END AS RCVQuantity,B.BatchCode from ICSDeliveryNotice A
LEFT JOIN ICSExtension B ON B.ID=A.ExtensionID AND B.WorkPoint=A.WorkPoint
WHERE DNCode='{0}' AND A.WorkPoint='{1}'
GROUP BY A.DNCode,B.BatchCode";
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd);
if (Sapdt.Rows.Count == 0)
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo205"), dr["TransNO"].ToString()));//单据查询失败
}
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU Client = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU();
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1 Info = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1();
Info.NEWID = Guid.NewGuid().ToString();
Info.PRUEFLOS = Sapdt.Rows[0]["DNCode"].ToString();
Info.L_LME = System.Decimal.Round(Convert.ToDecimal(Sapdt.Rows[0]["RCVQuantity"].ToString()), 3);
Info.SERNP = Sapdt.Rows[0]["BatchCode"].ToString();
Info.Z_GERNR = new SAPCallBackJYHGDVPN.ZWEBS_GERNR[0];
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse result = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse();
result = Client.CallZWMS_SK_WS_RUKU(Info);
if (result.Z_NULL == "N")
{
string logsql = @"insert into ICSWMSCallSAPErrorLog
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd);
if (Sapdt.Rows.Count == 0)
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo205"), dr["TransNO"].ToString()));//单据查询失败
}
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU Client = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU();
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1 Info = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKU1();
Info.NEWID = Guid.NewGuid().ToString();
Info.PRUEFLOS = Sapdt.Rows[0]["DNCode"].ToString();
Info.L_LME = System.Decimal.Round(Convert.ToDecimal(Sapdt.Rows[0]["RCVQuantity"].ToString()), 3);
Info.SERNP = Sapdt.Rows[0]["BatchCode"].ToString();
Info.Z_GERNR = new SAPCallBackJYHGDVPN.ZWEBS_GERNR[0];
SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse result = new SAPCallBackJYHGDVPN.ZWMS_SK_WS_RUKUResponse();
result = Client.CallZWMS_SK_WS_RUKU(Info);
if (result.Z_NULL == "N")
{
string logsql = @"insert into ICSWMSCallSAPErrorLog
(ID,DocType,DocNO,WorkPoint,MTIME,WorkType,EATTRIBUTE1)
Select NEWID(),'{0}','{1}','{2}',GETDATE(),'','{3}'";
logsql = string.Format(logsql, "采购入库", dr["TransNO"].ToString(), dr["WorkPoint"].ToString()
, result.L_MESSAGE);
DBHelper.ExecuteNonQuery(logsql, cmd);
logsql = string.Format(logsql, "采购入库", dr["TransNO"].ToString(), dr["WorkPoint"].ToString()
, result.L_MESSAGE);
DBHelper.ExecuteNonQuery(logsql, cmd);
}
#endregion
}
#endregion
}
else
{
#region SAP(三层结构)
string ErrorMessage = "";
chksql = @"select SUM(B.Quantity) AS Quantity,SUM(B.IssueNegQuantity) AS IssueQuantity from ICSMOApplyNeg A
else
{
#region SAP(三层结构)
string ErrorMessage = "";
chksql = @"select SUM(B.Quantity) AS Quantity,SUM(B.IssueNegQuantity) AS IssueQuantity from ICSMOApplyNeg A
LEFT JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.ApplyNegCode AND B.WorkPoint=A.WorkPoint
where A.ApplyNegCode='{0}' and A.WorkPoint='{1}'
GROUP BY A.ApplyNegCode,A.WorkPoint";
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) == Convert.ToDecimal(chkdt.Rows[0]["IssueQuantity"]))
{
SAPCallBackDocVPN.ZWMS_SK_WS_PZ Client = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ();
SAPCallBackDocVPN.ZWMS_SK_WS_PZ1 Info = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ1();
Info.NEWID = Guid.NewGuid().ToString();
Info.DANJU = dr["TransNO"].ToString();
Info.STATE = "0";
List<SAPCallBackDocVPN.ZWMS_PZ> ItemList = new List<SAPCallBackDocVPN.ZWMS_PZ>();
List<SAPCallBackDocVPN.ZWEBS_GERNR> ItemLineList = new List<SAPCallBackDocVPN.ZWEBS_GERNR>();
Info.Z_FLAG = new SAPCallBackDocVPN.ZWEB_RETURN[1];
sql = @" select A.ApplyNegCode,B.SAPSequence,B.InvCode,B.Sequence,B.Quantity,B.IssueNegQuantity
chksql = string.Format(chksql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (Convert.ToDecimal(chkdt.Rows[0]["Quantity"]) == Convert.ToDecimal(chkdt.Rows[0]["IssueQuantity"]))
{
SAPCallBackDocVPN.ZWMS_SK_WS_PZ Client = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ();
SAPCallBackDocVPN.ZWMS_SK_WS_PZ1 Info = new SAPCallBackDocVPN.ZWMS_SK_WS_PZ1();
Info.NEWID = Guid.NewGuid().ToString();
Info.DANJU = dr["TransNO"].ToString();
Info.STATE = "0";
List<SAPCallBackDocVPN.ZWMS_PZ> ItemList = new List<SAPCallBackDocVPN.ZWMS_PZ>();
List<SAPCallBackDocVPN.ZWEBS_GERNR> ItemLineList = new List<SAPCallBackDocVPN.ZWEBS_GERNR>();
Info.Z_FLAG = new SAPCallBackDocVPN.ZWEB_RETURN[1];
sql = @" select A.ApplyNegCode,B.SAPSequence,B.InvCode,B.Sequence,B.Quantity,B.IssueNegQuantity
,ISNULL(C.BatchCode,'') AS BatchCode from ICSMOApplyNeg A
LEFT JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.ApplyNegCode AND B.WorkPoint=A.WorkPoint
LEFT JOIN ICSExtension C ON C.ID=B.ExtensionID AND C.WorkPoint=B.WorkPoint
WHERE A.ApplyNegCode='{0}' AND A.WorkPoint='{1}'";
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd);
foreach (DataRow drs in Sapdt.Rows)
{
if (Convert.ToDecimal(drs["Quantity"].ToString()) == Convert.ToDecimal(drs["IssueNegQuantity"].ToString()))
sql = string.Format(sql, dr["TransNO"].ToString(), dr["WorkPoint"].ToString());
DataTable Sapdt = DBHelper.SQlReturnData(sql, cmd);
foreach (DataRow drs in Sapdt.Rows)
{
SAPCallBackDocVPN.ZWMS_PZ Item = new SAPCallBackDocVPN.ZWMS_PZ();
SAPCallBackDocVPN.ZWEBS_GERNR ItemLine = new SAPCallBackDocVPN.ZWEBS_GERNR();
Item.DANJU = drs["ApplyNegCode"].ToString();
Item.POSNR = drs["SAPSequence"].ToString();
Item.LINGYSL = System.Decimal.Round(Convert.ToDecimal(drs["Quantity"].ToString()), 3);
ItemList.Add(Item);
if (drs["BatchCode"].ToString() != "")
if (Convert.ToDecimal(drs["Quantity"].ToString()) == Convert.ToDecimal(drs["IssueNegQuantity"].ToString()))
{
ItemLine.DANJU = drs["ApplyNegCode"].ToString();
ItemLine.POSNR = drs["SAPSequence"].ToString();
ItemLine.MATNR = drs["InvCode"].ToString();
ItemLine.GERNR = drs["BatchCode"].ToString();
ItemLineList.Add(ItemLine);
SAPCallBackDocVPN.ZWMS_PZ Item = new SAPCallBackDocVPN.ZWMS_PZ();
SAPCallBackDocVPN.ZWEBS_GERNR ItemLine = new SAPCallBackDocVPN.ZWEBS_GERNR();
Item.DANJU = drs["ApplyNegCode"].ToString();
Item.POSNR = drs["SAPSequence"].ToString();
Item.LINGYSL = System.Decimal.Round(Convert.ToDecimal(drs["Quantity"].ToString()), 3);
ItemList.Add(Item);
if (drs["BatchCode"].ToString() != "")
{
ItemLine.DANJU = drs["ApplyNegCode"].ToString();
ItemLine.POSNR = drs["SAPSequence"].ToString();
ItemLine.MATNR = drs["InvCode"].ToString();
ItemLine.GERNR = drs["BatchCode"].ToString();
ItemLineList.Add(ItemLine);
}
}
}
}
if (ItemList.Count > 0)
{
Info.Z_ITEM = ItemList.ToArray();
if (ItemLineList.Count > 0)
if (ItemList.Count > 0)
{
Info.Z_GERNR = ItemLineList.ToArray();
}
else
{
Info.Z_GERNR = new SAPCallBackDocVPN.ZWEBS_GERNR[1];
}
SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse result = new SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse();
result = Client.CallZWMS_SK_WS_PZ(Info);
if (result.Z_NULL == "N")
{
foreach (SAPCallBackDocVPN.ZWEB_RETURN resultItem in result.Z_FLAG)
Info.Z_ITEM = ItemList.ToArray();
if (ItemLineList.Count > 0)
{
ErrorMessage += resultItem.L_MESSAGE + "/r/n";
Info.Z_GERNR = ItemLineList.ToArray();
}
string logsql = @"insert into ICSWMSCallSAPErrorLog
else
{
Info.Z_GERNR = new SAPCallBackDocVPN.ZWEBS_GERNR[1];
}
SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse result = new SAPCallBackDocVPN.ZWMS_SK_WS_PZResponse();
result = Client.CallZWMS_SK_WS_PZ(Info);
if (result.Z_NULL == "N")
{
foreach (SAPCallBackDocVPN.ZWEB_RETURN resultItem in result.Z_FLAG)
{
ErrorMessage += resultItem.L_MESSAGE + "/r/n";
}
string logsql = @"insert into ICSWMSCallSAPErrorLog
(ID,DocType,DocNO,WorkPoint,MTIME,WorkType,EATTRIBUTE1)
Select NEWID(),'{0}','{1}','{2}',GETDATE(),'','{3}'";
logsql = string.Format(logsql, "生产退料", dr["TransNO"].ToString(), dr["WorkPoint"].ToString()
, ErrorMessage);
DBHelper.ExecuteNonQuery(logsql, cmd);
logsql = string.Format(logsql, "生产退料", dr["TransNO"].ToString(), dr["WorkPoint"].ToString()
, ErrorMessage);
DBHelper.ExecuteNonQuery(logsql, cmd);
}
}
}
#endregion
}
#endregion
}
#endregion
#endregion
}
else if (TaskType == "PICK出库")
{
#region 出库(仅记录叉车搬运到的出库点位,用于后面的回库)
string sql = @" Update ICSForkLiftTaskLog SET EndLocation='{0}'
where ReqCode='{1}'";
sql = string.Format(sql, DestBin, TaskID);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
//throw new Exception("任务编码:" + TaskCode + ",日志记录失败");//料架状态更新失败
}
#endregion
}
#endregion
}
catch (Exception ex)
{
@ -3732,7 +3753,7 @@ namespace ICSSoft.DataProject
try
{
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' )
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' )
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{1}") + @"',16,1);
RETURN
@ -3745,10 +3766,10 @@ namespace ICSSoft.DataProject
END;
SELECT top 1 Desks FROM ICSMOApply WHERE ApplyCode='{2}'
";
sql = string.Format(sql, containerCode, User, tranCodes.FirstOrDefault());
sql = string.Format(sql, containerCode, User, tranCodes.FirstOrDefault());
var table = DBHelper.SQlReturnData(sql, cmd);
if (table.Rows.Count<=0)
if (table.Rows.Count <= 0)
{
throw new Exception("单据对应的工位不存在,操作失败");
}
@ -3761,16 +3782,16 @@ namespace ICSSoft.DataProject
END;
IF NOT EXISTS( SELECT ID FROM ICSMOApply WHERE ApplyCode='{0}' AND Desks='{1}')
BEGIN
RAISERROR('"+language.GetNameByCode("WMSAPIInfo477") + @"',16,1);
RAISERROR('" + language.GetNameByCode("WMSAPIInfo477") + @"',16,1);
RETURN
END;
IF EXISTS(select ID from ICSContainerReceiptsNumber where ContainerCode='{2}' AND TransCode='{0}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo479"), "{0}","{2}") + @"',16,1);
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo479"), "{0}", "{2}") + @"',16,1);
RETURN
END;
INSERT INTO ICSContainerReceiptsNumber SELECT NEWID(),'{0}','{2}',F_Account,F_RealName,GETDATE(),NULL,NULL,NULL,NULL,NULL FROM Sys_SRM_User WHERE F_Account='{3}' ";
sqlCheck= string.Format(sqlCheck, tranCode, table.Rows[0]["Desks"].ToString(),containerCode, User);
sqlCheck = string.Format(sqlCheck, tranCode, table.Rows[0]["Desks"].ToString(), containerCode, User);
if (!DBHelper.ExecuteNonQuery(sqlCheck, cmd))
{
throw new Exception("单据新增失败");
@ -3787,11 +3808,11 @@ namespace ICSSoft.DataProject
/// </summary>
/// <param name="LotNo"></param>
/// <param name="cmd"></param>
public static DataTable GetWHCodeArea(string LotNo,SqlCommand cmd)
public static DataTable GetWHCodeArea(string LotNo, SqlCommand cmd)
{
try
{
string check = $@"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
string check = $@"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
INNER JOIN ICSDeliveryNotice B ON B.DNCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint
INNER JOIN ICSInventoryDetail C ON C.INVCode=B.InvCode AND C.WHCode=B.WHCode AND C.WorkPoint=B.WorkPoint
WHERE A.LotNo='{LotNo}'

2
ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs

@ -2834,7 +2834,7 @@ namespace ICSSoft.WebAPI.Controllers
}
#endregion
#region 提供给叉车调用的回写接口,用于叉车完成搬运任务后回传任务编号,WMS入库并过账SAP(入库)
#region 提供给叉车调用的回写接口,用于叉车完成搬运任务后回传任务编号,WMS入库并过账SAP(入库:PTWY上架 出库:PICK出库
/// <summary>
/// 提供给AGV调用的回写接口
/// </summary>

Loading…
Cancel
Save