|
|
@ -9330,6 +9330,33 @@ UPDATE ICSExpressage SET ISNew='1',UnpackMUSER='{2}',UnpackMUSERName=(SELECT F_R |
|
|
|
string BusinessCode = string.Empty; |
|
|
|
try |
|
|
|
{ |
|
|
|
//查询库存是否足够
|
|
|
|
|
|
|
|
string sql = @" SELECT a.* ,a.Quantity-isnull(b.Quantity,0) Quantity1
|
|
|
|
FROM ( |
|
|
|
SELECT ExtensionID,INVCode,SUM(Quantity-MTDOCQuantity) Quantity,WHCode |
|
|
|
FROM ICSMTDOC a |
|
|
|
WHERE a.MTDOCCode= '{0}' AND Quantity-MTDOCQuantity>0 AND MTDOCType=1 and WorkPoint='{1}' |
|
|
|
GROUP BY ExtensionID,INVCode,WHCode) a |
|
|
|
LEFT JOIN (SELECT a.INVCode,b.ExtensionID,SUM(a.Quantity) Quantity,a.WarehouseCode WHCode |
|
|
|
FROM ICSWareHouseLotInfo a |
|
|
|
LEFT JOIN ICSInventoryLot b ON a.lotno=b.lotno and a.WorkPoint=b.WorkPoint |
|
|
|
WHERE a.Quantity>0 and a.WorkPoint='{1}' |
|
|
|
GROUP BY a.INVCode,b.ExtensionID,a.WarehouseCode) b ON a.ExtensionID=b.ExtensionID AND a.INVCode=b.INVCode AND a.WHCode=b.WHCode |
|
|
|
WHERE b.INVCode is NULL OR a.Quantity>isnull(b.Quantity,0)";
|
|
|
|
sql = string.Format(sql, JsonData.TransCode, JsonData.WorkPoint); |
|
|
|
DataTable sqldt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (sqldt != null && sqldt.Rows.Count > 0) |
|
|
|
{ |
|
|
|
string mes = ""; |
|
|
|
foreach (DataRow data in sqldt.Rows) |
|
|
|
{ |
|
|
|
mes += "物料" + data["INVCode"].ToString() + "库存缺失" + data["Quantity1"].ToString() + ";"; |
|
|
|
} |
|
|
|
throw new Exception("物料库存不足!"+ mes); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
string TransType = string.Empty; |
|
|
|
string Identification = Guid.NewGuid().ToString(); |
|
|
|
string doc = $@"SELECT ExtensionID,INVCode,MTDOCType,Sequence ,Quantity-MTDOCQuantity Quantity,WHCode,EATTRIBUTE1
|
|
|
@ -9365,9 +9392,9 @@ ORDER BY CAST(Sequence AS INT),MTDOCType"; |
|
|
|
//获取转换前物料所匹配条码
|
|
|
|
string lotList = @"SELECT a.*,b.ExtensionID FROM ICSWareHouseLotInfo a
|
|
|
|
LEFT JOIN ICSInventoryLot b ON a.lotno=b.lotno and a.WorkPoint=b.WorkPoint |
|
|
|
WHERE a.Quantity>0 AND a.INVCode='{0}' AND b.ExtensionID='{1}' and a.WorkPoint='{2}' |
|
|
|
WHERE a.Quantity>0 AND a.INVCode='{0}' AND b.ExtensionID='{1}' and a.WorkPoint='{2}' and WHCode='{3}' |
|
|
|
ORDER BY a.mtime desc ";
|
|
|
|
lotList = string.Format(lotList, beforInvCode, beforExtensionID, JsonData.WorkPoint); |
|
|
|
lotList = string.Format(lotList, beforInvCode, beforExtensionID, JsonData.WorkPoint, whCode); |
|
|
|
DataTable dtlotList = DBHelper.SQlReturnData(lotList, cmd); |
|
|
|
foreach (DataRow dr in dtlotList.Rows) |
|
|
|
{ |
|
|
|