CatMaoo 1 year ago
parent
commit
36b2b6b3a0
  1. 6
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs
  2. 68
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  3. 90
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs

6
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs

@ -949,10 +949,10 @@ SELECT a.FromWarehouseCode+b.IssueCode+a.MUSER+ISNULL(b.SourceCode,'')+ISNULL(c.
sql = @"UPDATE c SET IssueQuantity=ISNULL(IssueQuantity,0)-'{2}'
FROM ICSWareHouseLotInfoLog a
{3}
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{4}' and b.MoCode='{5}' AND b.Sequence='{6}'
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{4}' and b.MoCode='{5}' AND b.Sequence + '~' + c.Sequence='{6}'
IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfoLog a
{3}
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{4}' AND c.IssueQuantity<0 and b.MoCode='{5}' AND b.Sequence='{6}')
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.ID='{4}' AND c.IssueQuantity<0 and b.MoCode='{5}' AND b.Sequence + '~' + c.Sequence='{6}')
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo192") + @"',16,1);
END";
@ -2151,7 +2151,7 @@ INNER JOIN ICSConfiguration conStocknew ON a.WorkPoint=conStocknew.WorkPoint AND
INNER JOIN ICSConfiguration conStock ON conStock.Code='UpdateStock004' AND a.WorkPoint=conStock.WorkPoint
INNER JOIN ICSConfiguration conStocknew ON a.WorkPoint=conStocknew.WorkPoint AND conStocknew.Code='FillClose001'
WHERE a.Identification='{0}' AND ERPUpload='0' AND BusinessCode='{1}'
GROUP BY a.LotNo,inv.AmountEnable,a.ToWarehouseCode,lot.MUSER,a.InvCode,con.Enable,conv.Enable,conStock.Enable,conStocknew.Enable
GROUP BY a.LotNo,inv.AmountEnable,a.ToWarehouseCode,a.MUSER,lot.MUSER,a.InvCode,con.Enable,conv.Enable,conStock.Enable,conStocknew.Enable
,a.WorkPoint,ISNULL(ext.ProjectCode, '') ,
CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END,
ISNULL(ext.Version, '') ,

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

@ -4126,12 +4126,48 @@ a.ExtensionID
|| TransType == TransTypeEnum.MOIssueDocNegativeApply.GetDescription()
|| TransType == TransTypeEnum.MOIssueDocNegativeIssue.GetDescription())
{
log.Debug("生产退料1" + TransTypeEnum.MOIssueDocNegative.GetDescription());
log.Debug("生产退料2" + TransTypeEnum.MOIssueDocNegativeApply.GetDescription());
log.Debug("生产退料3" + TransTypeEnum.MOIssueDocNegativeIssue.GetDescription());
log.Debug("生产退料4" + TransType);
//工单行查子件信息
string chekkksql = @"select a.Sequence,a.InvCode FROM ICSMOPick a
INNER JOIN ICSMO b ON a.MODetailID=b.MODetailID AND a.WorkPoint=b.WorkPoint
WHERE b.MOCode='{0}' AND b.Sequence='{2}' AND a.WorkPoint='{1}' ";
chekkksql = string.Format(chekkksql, itemInfo.TransCode, item.WorkPoint, itemInfo.TransSequence);
log.Debug("工单行查子件信息" + chekkksql);
DataTable dtaa = DBHelper.SQlReturnData(chekkksql, cmd);
//查询条码的物料
string cheklotsql = @"select a.InvCode FROM ICSInventoryLot a
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' ";
cheklotsql = string.Format(cheklotsql, itemInfo.LotNo, item.WorkPoint);
log.Debug("查询条码的物料" + cheklotsql);
DataTable lotdata = DBHelper.SQlReturnData(cheklotsql, cmd);
//DataTable ad0=dtaa.Select(a => a.invcode == lotdata.Rows[0]["InvCode"].ToString());
DataRow[] drs = dtaa.Select("InvCode ='" + lotdata.Rows[0]["InvCode"].ToString() + "'");
if (drs == null || drs.Length == 0)
{
throw new Exception("当前扫描的条码物料和单据子件物料没有匹配的行,请确认!");
}
//DataTable ad0 = dtaa.AsEnumerable()
//.Where(a => a.Field<string>("InvCode") == lotdata.Rows[0]["InvCode"].ToString())
//.CopyToDataTable();
//if (ad0 == null || ad0.Rows.Count == 0)
//{
// throw new Exception("当前扫描的条码物料和单据子件物料没有匹配的行,请确认!");
//}
string seq = itemInfo.TransSequence + "~" + drs[0]["Sequence"].ToString();
log.Debug("工单子件行号:" + seq);
string chekksql = @"select c.EATTRIBUTE1 FROM ICSMOPick a
INNER JOIN ICSMO b ON a.MODetailID=b.MODetailID AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSInventory c on a.InvCode=c.InvCode and a.WorkPoint=c.WorkPoint
WHERE b.MOCode='{0}' AND b.Sequence+'~'+a.Sequence='{3}' AND a.WorkPoint='{1}' and c.AmountEnable='1'";
chekksql = string.Format(chekksql, itemInfo.TransCode, item.WorkPoint, itemInfo.Quantity, seq);
DataTable dta = DBHelper.SQlReturnData(chekksql, cmd);
if (dta.Rows.Count > 0)
{
itemInfo.Quantity = (decimal.Parse(itemInfo.Quantity) * decimal.Parse(dta.Rows[0]["EATTRIBUTE1"].ToString())).ToString();
}
//更新源头单据数量
ICSManufactureService.AMMOIssueDocNegative(TransType, itemInfo.LogID, itemInfo.LotNo, itemInfo.Quantity, item.WorkPoint,itemInfo.TransCode,itemInfo.TransSequence, cmd, language);
ICSManufactureService.AMMOIssueDocNegative(TransType, itemInfo.LogID, itemInfo.LotNo, itemInfo.Quantity, item.WorkPoint,itemInfo.TransCode, seq, cmd, language);
BusinessCode = TransTypeEnum.MOIssueDocNegative.GetDescription<DBValue>();
log.Debug("生产退料5");
}
@ -4288,6 +4324,25 @@ a.ExtensionID
BusinessCode = TransTypeEnum.MOStockINByProduct.GetDescription<DBValue>();
}
#endregion
#region 委外副产品入库
else if (TransType == TransTypeEnum.OOStockINByProduct.GetDescription())
{
log.Debug("副产品入库" + TransType);
//更新源头单据数量
ICSManufactureService.OOStockINByProductDoc(itemInfo.LotNo, itemInfo.Quantity, item.WorkPoint, cmd, language);
BusinessCode = TransTypeEnum.OOStockINByProduct.GetDescription<DBValue>();
}
#endregion
#region 副产品入库(无源头)
else if (TransType == TransTypeEnum.MOStockINByProductNoTrans.GetDescription())
{
log.Debug("无源头副产品入库" + TransType);
//更新源头单据数量
//ICSManufactureService.MOStockINByProductDoc(itemInfo.LotNo, itemInfo.Quantity, item.WorkPoint, cmd, language);
BusinessCode = TransTypeEnum.MOStockINByProductNoTrans.GetDescription<DBValue>();
}
#endregion
else
{
throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!"
@ -4350,6 +4405,9 @@ a.ExtensionID
//委外副产品入库
else if (TransType == TransTypeEnum.OOStockINByProduct.GetDescription())
ICSManufactureService.OOStockINByProductDocERP(TransType, Identification, cmd, language, BusinessCode);
//无源头副产品入库
else if (TransType == TransTypeEnum.MOStockINByProductNoTrans.GetDescription())
ICSManufactureService.MOStockINByProductNoTransDocERP(TransType, Identification, cmd, language, BusinessCode);
//开立的生产入库单
else if (TransType == TransTypeEnum.ManufactureReceive.GetDescription())
ICSManufactureService.ManufactureReceiveERP(TransType, Identification, cmd, language, BusinessCode);

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

@ -733,6 +733,62 @@ namespace ICSSoft.DataProject
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo171"), LotNo));
}
newlocationcode = dt.Rows[0]["FromLocationCode"].ToString();
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
IF EXISTS(SELECT a.LotNo FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}')
BEGIN
IF EXISTS(SELECT a.LotNO FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.Quantity=0)
BEGIN
UPDATE a SET a.Quantity=ISNULL(a.Quantity,0)+'{3}',WarehouseCode=e.WarehouseCode,LocationCode=d.LocationCode
From ICSWareHouseLotInfo a
INNER JOIN ICSLocation d ON d.LocationCode='{4}' AND a.WorkPoint=d.WorkPoint
INNER JOIN ICSWarehouse e ON d.WHID=e.ID AND d.WorkPoint=e.WorkPoint
WHERE a.LotNo='{0}' AND a.WorkPoint='{1}'
END
ELSE IF EXISTS(SELECT a.LotNO FROM ICSWareHouseLotInfo a WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND a.LocationCode=(select a.FromLocationCode FROM ICSWareHouseLotInfoLog a WHERE a.LotNo='CP-41100212' AND a.WorkPoint='UFDATA_999_2021' AND a.id='{5}'
AND a.FromLocationCode='" + locationcode + @"'))
BEGIN
UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)+'{3}'
WHERE LotNo='{0}' AND WorkPoint='{1}'
END
ELSE
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo395"), "{4}", locationcode) + @"', 16, 1);
RETURN
END
END
ELSE
BEGIN
IF EXISTS(SELECT il.InvCode FROM ICSInventoryLocation il
INNER JOIN ICSInventoryLot a ON a.InvCode=il.InvCode AND a.WorkPoint=il.WorkPoint
WHERE il.Enable='1' AND a.LotNo='{0}' AND a.WorkPoint='{1}')
BEGIN
IF NOT EXISTS(SELECT il.InvCode FROM ICSInventoryLocation il
INNER JOIN ICSInventoryLot a ON a.InvCode=il.InvCode AND a.WorkPoint=il.WorkPoint
WHERE il.Enable='1' AND a.LotNo='{0}' AND a.WorkPoint='{1}' AND il.LocationCode='{4}')
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo180") + @"',16,1);
RETURN
END
END
INSERT INTO ICSWareHouseLotInfo(ID,LotNO,WarehouseCode,LocationCode,InvCode,Quantity,InDate,LockQuantity,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1)
SELECT NEWID(),a.LotNo ,e.WarehouseCode,d.LocationCode,a.InvCode ,'{3}',SYSDATETIME(),'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 ICSOApplyNegDetail c ON b.TransCode=c.OApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
INNER JOIN ICSLocation d ON d.LocationCode='{4}' AND a.WorkPoint=d.WorkPoint
INNER JOIN ICSWarehouse e ON d.WHID=e.ID AND d.WorkPoint=e.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}'
END";
sql = string.Format(sql, LotNo, WorkPoint, User, Quantity, newlocationcode, LogID);
}
else if (BusinessCode == TransTypeEnum.MOStockINByProductNoTrans.GetDescription<DBValue>())
{
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);
@ -777,14 +833,14 @@ namespace ICSSoft.DataProject
INSERT INTO ICSWareHouseLotInfo(ID,LotNO,WarehouseCode,LocationCode,InvCode,Quantity,InDate,LockQuantity,MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1)
SELECT NEWID(),a.LotNo ,e.WarehouseCode,d.LocationCode,a.InvCode ,'{3}',SYSDATETIME(),'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
LEFT JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
--INNER JOIN ICSOApplyNegDetail c ON b.TransCode=c.OApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint
INNER JOIN ICSLocation d ON d.LocationCode='{4}' AND a.WorkPoint=d.WorkPoint
INNER JOIN ICSWarehouse e ON d.WHID=e.ID AND d.WorkPoint=e.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}'
END";
sql = string.Format(sql, LotNo, WorkPoint, User, Quantity, newlocationcode);
sql = string.Format(sql, LotNo, WorkPoint, User, Quantity, LocationCode);
}
else
{
@ -915,6 +971,35 @@ namespace ICSSoft.DataProject
";
sql = string.Format(sql, LotNo, WorkPoint, User, Identification, TransType, BusinessCode, Quantity, LogID);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
}
}
else if (BusinessCode == TransTypeEnum.MOStockINByProductNoTrans.GetDescription<DBValue>())
{
///添加日志
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}',b.TransCode,b.TransSequence,a.LotNo ,a.InvCode ,
'','',c.WarehouseCode,c.LocationCode,'{6}',
'','0','{4}','{5}','0','',
'','','',f.F_Account ,f.F_RealName ,
SYSDATETIME() ,a.WorkPoint ,'','{7}'
FROM ICSInventoryLot a
LEFT 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, LogID);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo166"));
@ -993,7 +1078,6 @@ namespace ICSSoft.DataProject
}
}
#endregion
#region 管控方式是"料品"时

Loading…
Cancel
Save