Browse Source

客供料到货、自购料到货

master
姜鹏 3 weeks ago
parent
commit
53d4e6a21a
  1. 84
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs
  2. 416
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  3. 179
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
  4. 4
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config

84
ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs

@ -2037,6 +2037,88 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in
Result result = new Result();
result = JsonConvert.DeserializeObject<Result>(resultStr);
if (result.Success)
{
//try
//{
// JArray res = (JArray)JsonConvert.DeserializeObject(result.Data.ToString());
// foreach (var item in res)
// {
// JObject jo = (JObject)item;
// JArray resdetail = (JArray)JsonConvert.DeserializeObject(jo["details"].ToString());
// foreach (var detail in resdetail)
// {
// JObject det = (JObject)detail;
// string ERPupdate = @"update ICSDeliveryNotice set DNCode='{0}',Sequence='{1}',DNID='{2}',DNDetailID='{3}'
// where PODetailID='{4}' AND DNType='1' AND DNCode='{5}' and Sequence='{1}'";
// ERPupdate = string.Format(ERPupdate, jo["DNCode"], det["Sequence"], jo["ID"], det["DetailID"], det["PODetailID"], DNCode);
// if (!DBHelper.ExecuteNonQuery(ERPupdate, cmd))
// {
// throw new Exception(language.GetNameByCode("WMSAPIInfo079"));//"到货单更新失败!");
// }
// }
// }
//}
//catch (Exception ex)
//{
// log.Debug(ex.ToString());
// log.Debug(resultStr);
//}
}
else
{
throw new Exception(language.GetNameByCode("WMSAPIInfo080") + result.Message);
}
#endregion
}
catch (Exception)
{
throw;
}
}
#endregion
#region YS到货单创建
public static void YSDeliveryNoticeERP(string DNCode, string WorkPoint, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
#region ERP
string sql = "";
sql = @"SELECT a.VenCode+a.DepCode+a.MUSER AS Costre,a.VenCode,a.DepCode,y.POCode,a.MUSER,a.MTIME,
a.Sequence,a.InvCode,a.Quantity,CASE invBat.AmountEnable WHEN '1' THEN a.Amount ELSE '0' END AS Amount,ISNULL(a.UnitPrice,0) AS UnitPrice,a.Currency,a.PODetailID
,a.WorkPoint,ISNULL(ext.ProjectCode, '') AS ProjectCode,CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode,ISNULL(ext.Version, '') AS Version,ISNULL(ext.Brand, '') AS Brand,
ISNULL(ext.cFree1, '') AS cFree1,ISNULL(ext.cFree2, '') AS cFree2,ISNULL(ext.cFree3, '') AS cFree3,ISNULL(ext.cFree4, '') AS cFree4,ISNULL(ext.cFree5, '') AS cFree5,ISNULL(ext.cFree6, '') AS cFree6,ISNULL(ext.cFree7, '') AS cFree7,ISNULL(ext.cFree8, '') AS cFree8,ISNULL(ext.cFree9, '') AS cFree9,ISNULL(ext.cFree10, '') AS cFree10
INTO #TempERP
FROM ICSDeliveryNotice a
INNER JOIN ICSExtension ext ON a.ExtensionID=ext.ID AND a.WorkPoint=ext.WorkPoint
LEFT JOIN ICSInventory invBat ON a.InvCode=invBat.InvCode AND a.WorkPoint=invBat.WorkPoint
INNER JOIN ICSPurchaseOrder y ON a.PODetailID=y.PODetailID AND a.WorkPoint=y.WorkPoint
WHERE a.DNCode='{0}' AND a.WorkPoint='{1}'
-- SELECT DISTINCT Costre,WorkPoint,VenCode,DepCode,POCode,MUSER AS [User],SYSDATETIME() AS MTime FROM #TempERP
-- SELECT Costre,Sequence,InvCode,Quantity,Amount,UnitPrice,Currency,PODetailID,ProjectCode,BatchCode,Version,Brand,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10
-- FROM #TempERP
SELECT DISTINCT Costre,WorkPoint,VenCode,DepCode
,CASE (SELECT Enable FROM ICSConfiguration WHERE Code='POCodeDisplayed' AND WorkPoint='{1}') WHEN 0 THEN '' ELSE POCode END AS POCode
,MUSER AS [User],SYSDATETIME() AS MTime FROM #TempERP
SELECT Costre,Sequence,InvCode,Quantity,Amount,UnitPrice,Currency,POCode,PODetailID,ProjectCode,BatchCode,Version,Brand,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10
FROM #TempERP
DROP TABLE #TempERP";
sql = string.Format(sql, DNCode, WorkPoint);
DataSet ds = DBHelper.SQlReturnDataSet(sql, cmd);
string Inputstr = DataToJsonHelper.DataSetToJson(ds, "details", "Costre");
string resultStr = HTTPHelper.HttpPost("采购到货", ERPUrl.CreatePOArrivURL, Inputstr);
Result result = new Result();
result = JsonConvert.DeserializeObject<Result>(resultStr);
if (result.Success)
{
try
{
@ -2078,5 +2160,7 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in
}
}
#endregion
}
}

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

@ -7364,86 +7364,6 @@ ISNULL(c.MTIME,'') AS MTIME,'' AS VenCode,'' AS cVenName,d.InvUnit,'' AS POCode,
";
}
else
{
//派纳调拨,不用站点条件
if (DBHelper.IsPNU9() && TransType == TransTypeEnum.OneStepTransferDocIn.GetDescription())
{
if (ScanType == "LOTNO")
{
sql = @"SELECT a.ID,
con.ContainerCode,
con.ContainerName,
a.LotNo,
a.InvCode,
inv.InvName,
inv.InvStd,
inv.InvUnit,
inv.LotEnable,
{0}
inv.AmountUnit,
ext.ID AS ExtensionID,
ext.ProjectCode,
ext.Version,
--ext.BatchCode,
ext.Brand,
ext.cFree1,
ext.cFree2,
ext.cFree3,
ext.cFree4,
ext.cFree5,
ext.cFree6,
ext.cFree7,
ext.cFree8,
ext.cFree9,
ext.cFree10,
a.MUSER AS [User],
a.MTIME AS [MTime],
'" + ScanType + @"' AS ScanType
FROM {1}
LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint
LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
WHERE a.LotNo='{2}' ";
}
else
{
sql = @"SELECT a.ID,
con.ContainerCode,
con.ContainerName,
a.LotNo,
a.InvCode,
inv.InvName,
inv.InvStd,
inv.InvUnit,
{0}
inv.AmountUnit,
ext.ID AS ExtensionID,
ext.ProjectCode,
ext.Version,
--ext.BatchCode,
ext.Brand,
ext.cFree1,
ext.cFree2,
ext.cFree3,
ext.cFree4,
ext.cFree5,
ext.cFree6,
ext.cFree7,
ext.cFree8,
ext.cFree9,
ext.cFree10,
a.MUSER AS [User],
a.MTIME AS [MTime],
'" + ScanType + @"' AS ScanType
FROM {1}
LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint
LEFT JOIN ICSBomALL bom ON bom.ID=conlot.ContainerID
LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
WHERE bom.TContainerCode='{2}' ";
}
}
else
{
if (ScanType == "LOTNO")
{
@ -7742,7 +7662,7 @@ ISNULL(c.MTIME,'') AS MTIME,'' AS VenCode,'' AS cVenName,d.InvUnit,'' AS POCode,
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
WHERE bom.TContainerCode='{2}' AND a.WorkPoint='{3}' AND a.Quantity>0";
}
}
}
@ -9290,12 +9210,9 @@ BEGIN
|| TransType == TransTypeEnum.ManufactureReceive.GetDescription() || TransType == TransTypeEnum.OOStockINByProduct.GetDescription()
|| TransType == TransTypeEnum.MOStockINByProduct.GetDescription() || TransType == TransTypeEnum.OtherInDoc.GetDescription() || TransType == TransTypeEnum.OutsourcingReceiveRevDoc.GetDescription()
|| TransType == TransTypeEnum.PurchaseReceiveRevDoc.GetDescription() || TransType == TransTypeEnum.ManufactureMESReceive.GetDescription()) && needIns)
{
if (DBHelper.IsPNU9() && TransType == TransTypeEnum.PurchaseReceiveRevDoc.GetDescription())
{
columns = @"ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a.Quantity*(a.Amount/a.Quantity) AS Amount,
isnull(pev.EATTRIBUTE3,'') AS VenName,
{0},{2},
lotdd.TransCode,lotdd.TransSequence,
{3}
@ -9305,41 +9222,7 @@ BEGIN
tableName = @"ICSInventoryLot a
INNER JOIN ICSExtension ext ON a.ExtensionID=ext.ID AND a.WorkPoint=ext.WorkPoint
LEFT JOIN ICSInventoryLotDetail lotdd ON lotdd.LotNo=a.LotNo AND a.WorkPoint=lotdd.WorkPoint
LEFT JOIN ICSPurchaseReceive pev ON lotdd.TransCode=pev.RCVCode AND lotdd.TransSequence=pev.Sequence AND lotdd.WorkPoint=pev.WorkPoint
LEFT JOIN ICSInspection ins ON a.LotNo=ins.LotNo AND a.WorkPoint=ins.WorkPoint and ins.enable = 1";
}
else if (DBHelper.IsPNU9() && TransType == TransTypeEnum.OutsourcingReceiveRevDoc.GetDescription())
{
columns = @"ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a.Quantity*(a.Amount/a.Quantity) AS Amount,
isnull(pev.EATTRIBUTE3,'') AS VenName,
{0},{2},
lotdd.TransCode,lotdd.TransSequence,
{3}
{1}
ext.BatchCode AS BatchCode,";
tableName = @"ICSInventoryLot a
INNER JOIN ICSExtension ext ON a.ExtensionID=ext.ID AND a.WorkPoint=ext.WorkPoint
LEFT JOIN ICSInventoryLotDetail lotdd ON lotdd.LotNo=a.LotNo AND a.WorkPoint=lotdd.WorkPoint
LEFT JOIN ICSOutsourcingReceive pev ON lotdd.TransCode=pev.RCVCode AND lotdd.TransSequence=pev.Sequence AND lotdd.WorkPoint=pev.WorkPoint
LEFT JOIN ICSInspection ins ON a.LotNo=ins.LotNo AND a.WorkPoint=ins.WorkPoint and ins.enable = 1";
}
else
{
columns = @"ISNULL(ins.QualifiedQuantity+ins.WaiveQuantity, a.Quantity) AS Quantity,
a.Quantity*(a.Amount/a.Quantity) AS Amount,
{0},{2},
lotdd.TransCode,lotdd.TransSequence,
{3}
{1}
ext.BatchCode AS BatchCode,";
tableName = @"ICSInventoryLot a
INNER JOIN ICSExtension ext ON a.ExtensionID=ext.ID AND a.WorkPoint=ext.WorkPoint
LEFT JOIN ICSInventoryLotDetail lotdd ON lotdd.LotNo=a.LotNo AND a.WorkPoint=lotdd.WorkPoint
LEFT JOIN ICSInspection ins ON a.LotNo=ins.LotNo AND a.WorkPoint=ins.WorkPoint and ins.enable = 1";
}
}
else if (TransType == TransTypeEnum.SalesShipmentDocNegative.GetDescription())
@ -33018,7 +32901,304 @@ END as NEWLotNo
}
}
public static DataTable YSDeliveryNoticeCreate(List<ICSDeliveryNotice> JsonData)
{
var language = LanguageHelper.GetName("WMSAPIInfo");
if (JsonData.Count <= 0)
{
throw new Exception(language.GetNameByCode("WMSAPIInfo007"));//"传送数据为空!"
}
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
{
conn.Open();
SqlTransaction sqlTran = conn.BeginTransaction();
SqlCommand cmd = new SqlCommand();
cmd.Transaction = sqlTran;
cmd.Connection = conn;
cmd.CommandTimeout = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TimeOut"]);
try
{
string asncodes = string.Empty;
string DNCodes = string.Empty;
string DNLotNo = string.Empty;
string sql = string.Empty;
string picname = string.Empty;
string Colspan = "";
string IDD = "";
string whcode = "";
foreach (var item in JsonData)
{
if (string.IsNullOrEmpty(item.ASNCode))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo009"));//"送货单号不能为空!"
}
sql = @"SELECT a.DNCode FROM ICSDeliveryNotice a WHERE a.ASNCode='{0}' AND DNType = '1' AND a.WorkPoint='{1}'";
sql = string.Format(sql, item.ASNCode, item.WorkPoint);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt.Rows.Count > 0)
{
DNCodes = dt.Rows[0]["DNCode"].ToString();
}
//获取单号
sql = @"IF EXISTS(SELECT a.ID FROM ICSDeliveryNotice a WHERE a.ASNCode='{0}' AND DNType = '1' AND a.WorkPoint='{1}')
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo057") + @"',16,1);
RETURN
END
DECLARE @Status VARCHAR(10)
SELECT @Status=Status FROM ICSASN WHERE ASNCode='{0}' and WorkPoint='{1}'
IF (@Status IS NULL)
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo058") + @"',16,1);
RETURN
END
ELSE IF (@Status!='2')
BEGIN
RAISERROR('" + language.GetNameByCode("WMSAPIInfo059") + @"',16,1);
RETURN
END
DECLARE @MaxNO INT,@date varchar(20)='DN'+SUBSTRING(CONVERT(varchar(8), GETDATE(), 112), 1, 8)
SELECT @MaxNO=SUBSTRING(MAX(DNCode),LEN(@date)+1,LEN(MAX(DNCode))-LEN(@date))+1 FROM ICSDeliveryNotice
WHERE SUBSTRING(DNCode, 1, LEN(@date))=@date
IF @MaxNO IS NULL
BEGIN
SELECT @date+'00001' AS Code
END
ELSE
BEGIN
SELECT @date+REPLICATE('0',5-LEN(@MaxNO))+CAST(@MaxNO AS nvarchar(10)) AS Code
END ";
sql = string.Format(sql, item.ASNCode, item.WorkPoint, DNCodes);
string Code = DBHelper.ExecuteScalar(sql, cmd).ToString();
//修改送货单到货数量
foreach (var itemInfo in item.detail)
{
if (string.IsNullOrEmpty(itemInfo.TransSequence))
{
picname = "";
}
else
{
picname = itemInfo.TransSequence;
}
sql = @"
UPDATE ICSASNDetail SET DNQuantity=ISNULL(DNQuantity, 0)+'{2}'
WHERE LotNo='{0}' AND WorkPoint='{1}'
IF EXISTS(SELECT id FROM ICSASNDetail WHERE LotNo='{0}' AND WorkPoint='{1}' AND Quantity<DNQuantity)
BEGIN
RAISERROR(',',16,1);
RETURN
END ";
sql = string.Format(sql, itemInfo.LotNo, item.WorkPoint, itemInfo.Quantity);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo010")); //"送货单子表信息更新失败!");
}
sql = @"UPDATE ICSInventoryLot SET Quantity='{2}'
WHERE LotNo='{0}' AND WorkPoint='{1}'";
if (itemInfo.IsUrgency == "1")
sql = @"UPDATE ICSInventoryLot SET Quantity='{2}' ,eattribute6 = '1' WHERE LotNo='{0}' AND WorkPoint='{1}'";
sql = string.Format(sql, itemInfo.LotNo, item.WorkPoint, itemInfo.Quantity);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo462")); //"条码表信息更新失败!");
}
if (DNLotNo.Equals(""))
{
DNLotNo = "'" + itemInfo.LotNo + "'";
}
else
{
DNLotNo = ",'" + itemInfo.LotNo + "";
}
}
//到货指定仓库(批次汇总)
string Dsql = @"SELECT a.F_itemCode
FROM Sys_SRM_ItemsDetail a
INNER JOIN Sys_SRM_Items b ON a.F_ItemId=b.F_Id
WHERE b.F_EnCode='DaoWHCode' AND a.F_EnabledMark='1'";
Dsql = string.Format(Dsql);
DataTable dtdao = DBHelper.SQlReturnData(Dsql, cmd);
if (dtdao.Rows.Count > 0 && dtdao != null)
{
whcode = dtdao.Rows[0]["F_itemCode"].ToString();
//创建到货单信息
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' AND F_Location='{2}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{1}") + @"',16,1);
RETURN
END
Insert into ICSExtension(ID, Colspan, ProjectCode, BatchCode, Version, Brand, cFree1, cFree2, cFree3, cFree4, cFree5, cFree6, cFree7, cFree8, cFree9, cFree10)
SELECT DISTINCT newid(),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, '')+'~'+ISNULL(ext.Brand, '')+'~'+
ISNULL(ext.cFree1, '')+'~'+ISNULL(ext.cFree2, '')+'~'+ISNULL(ext.cFree3, '')+'~'+ISNULL(ext.cFree4, '')+'~'+ISNULL(ext.cFree5, '')+'~'+ISNULL(ext.cFree6, '')+'~'+ISNULL(ext.cFree7, '')+'~'+ISNULL(ext.cFree8, '')+'~'+ISNULL(ext.cFree9, '')+'~'+ISNULL(ext.cFree10, ''),ISNULL(ext.ProjectCode, '') AS 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 AS BatchCode,ISNULL(ext.Version, '') AS Version,ISNULL(ext.Brand, '') AS Brand,
ISNULL(ext.cFree1, '') AS cFree1,ISNULL(ext.cFree2, '') AS cFree2,ISNULL(ext.cFree3, '') AS cFree3,ISNULL(ext.cFree4, '') AS cFree4,ISNULL(ext.cFree5, '') AS cFree5,ISNULL(ext.cFree6, '') AS cFree6,ISNULL(ext.cFree7, '') AS cFree7,ISNULL(ext.cFree8, '') AS cFree8,ISNULL(ext.cFree9, '') AS cFree9,ISNULL(ext.cFree10, '') AS cFree10
FROM ICSASNDetail a
INNER JOIN ICSInventoryLot b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSExtension ext ON b.ExtensionID=ext.ID AND b.WorkPoint=ext.WorkPoint
LEFT JOIN ICSInventory inv ON b.InvCode=inv.InvCode AND b.WorkPoint=inv.WorkPoint
LEFT JOIN ICSInventoryBatchEnable invBat ON b.InvCode=invBat.InvCode AND '{5}'=invBat.WHCode AND b.WorkPoint=invBat.WorkPoint
INNER JOIN ICSExtension extt ON 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, '')+'~'+ISNULL(ext.Brand, '')+'~'+
ISNULL(ext.cFree1, '')+'~'+ISNULL(ext.cFree2, '')+'~'+ISNULL(ext.cFree3, '')+'~'+ISNULL(ext.cFree4, '')+'~'+ISNULL(ext.cFree5, '')+'~'+ISNULL(ext.cFree6, '')+'~'+ISNULL(ext.cFree7, '')+'~'+ISNULL(ext.cFree8, '')+'~'+ISNULL(ext.cFree9, '')+'~'+ISNULL(ext.cFree10, '')=extt.Colspan
WHERE a.ASNCode='{3}' AND a.WorkPoint='{2}' and a.DNQuantity>0 AND ext.id is NULL
INSERT INTO ICSDeliveryNotice(ID,DNCode,Sequence,VenCode,DepCode,
DNType,InvCode,Quantity,Amount,RCVQuantity,
UnitPrice,Currency,Status,CreatePerson,CreateDateTime,
POID,PODetailID,DNID,DNDetailID,ExtensionID,
MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1,ASNCode,EATTRIBUTE8)
SELECT NEWID(),'{0}',row_number() OVER (ORDER BY b.InvCode),d.VenCode,d.DepCode,
'1',b.InvCode,SUM(a.DNQuantity),'0','0',
d.UnitPrice,d.Currency,'2',e.F_Account,GETDATE(),
d.POID,d.PODetailID,'{0}',newid(),extt.ID,
e.F_Account,e.F_RealName,GETDATE(),a.WorkPoint,'',a.ASNCode,'{4}'
FROM ICSASNDetail a
INNER JOIN ICSInventoryLot b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSInventoryLotDetail c ON b.LotNo=c.LotNo AND b.WorkPoint=c.WorkPoint
INNER JOIN ICSExtension ext ON b.ExtensionID=ext.ID AND b.WorkPoint=ext.WorkPoint
LEFT JOIN ICSInventory inv ON b.InvCode=inv.InvCode AND b.WorkPoint=inv.WorkPoint
LEFT JOIN ICSInventoryBatchEnable invBat ON b.InvCode=invBat.InvCode AND '{5}'=invBat.WHCode AND b.WorkPoint=invBat.WorkPoint
INNER JOIN ICSExtension extt ON 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, '')+'~'+ISNULL(ext.Brand, '')+'~'+
ISNULL(ext.cFree1, '')+'~'+ISNULL(ext.cFree2, '')+'~'+ISNULL(ext.cFree3, '')+'~'+ISNULL(ext.cFree4, '')+'~'+ISNULL(ext.cFree5, '')+'~'+ISNULL(ext.cFree6, '')+'~'+ISNULL(ext.cFree7, '')+'~'+ISNULL(ext.cFree8, '')+'~'+ISNULL(ext.cFree9, '')+'~'+ISNULL(ext.cFree10, '')=extt.Colspan
INNER JOIN ICSPurchaseOrder d ON c.TransCode=d.POCode AND c.TransSequence=d.Sequence AND c.WorkPoint=d.WorkPoint
INNER JOIN Sys_SRM_User e ON e.F_Account='{1}' AND e.F_Location='{2}'
WHERE a.ASNCode='{3}' AND a.WorkPoint='{2}' and a.DNQuantity>0
GROUP BY d.POID,d.PODetailID,d.VenCode,d.UnitPrice,d.Currency,d.DepCode,b.InvCode,a.ASNCode,e.F_Account,e.F_RealName,a.WorkPoint,extt.ID";
sql = string.Format(sql, Code, item.User, item.WorkPoint, item.ASNCode, picname, whcode);
}
else
{
//创建到货单信息
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{1}' AND F_Location='{2}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{1}") + @"',16,1);
RETURN
END
INSERT INTO ICSDeliveryNotice(ID,DNCode,Sequence,VenCode,DepCode,
DNType,InvCode,Quantity,Amount,RCVQuantity,
UnitPrice,Currency,Status,CreatePerson,CreateDateTime,
POID,PODetailID,DNID,DNDetailID,ExtensionID,
MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1,ASNCode,EATTRIBUTE8)
SELECT NEWID(),'{0}',row_number() OVER (ORDER BY b.InvCode),d.VenCode,d.DepCode,
'1',b.InvCode,SUM(a.DNQuantity),'0','0',
d.UnitPrice,d.Currency,'2',e.F_Account,GETDATE(),
d.POID,d.PODetailID,'{0}',newid(),b.ExtensionID,
e.F_Account,e.F_RealName,GETDATE(),a.WorkPoint,'',a.ASNCode,'{4}'
FROM ICSASNDetail a
INNER JOIN ICSInventoryLot b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint
INNER JOIN ICSInventoryLotDetail c ON b.LotNo=c.LotNo AND b.WorkPoint=c.WorkPoint
INNER JOIN ICSPurchaseOrder d ON c.TransCode=d.POCode AND c.TransSequence=d.Sequence AND c.WorkPoint=d.WorkPoint
INNER JOIN Sys_SRM_User e ON e.F_Account='{1}' AND e.F_Location='{2}'
WHERE a.ASNCode='{3}' AND a.WorkPoint='{2}' and a.DNQuantity>0
GROUP BY d.POID,d.PODetailID,d.VenCode,d.UnitPrice,d.Currency,d.DepCode,b.ExtensionID,b.InvCode,a.ASNCode,e.F_Account,e.F_RealName,a.WorkPoint";
sql = string.Format(sql, Code, item.User, item.WorkPoint, item.ASNCode, picname);
}
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo011")); //"到货单信息创建失败!");
}
string sqlCheckSign = @"select * from ICSConfiguration where code = 'UploadERP001' and enable = '1'";
DataTable flag = DBHelper.SQlReturnData(sqlCheckSign, cmd);
if (flag != null && flag.Rows.Count > 0)
{
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
{
ICSPurchaseService.YSDeliveryNoticeERP(Code, item.WorkPoint, cmd, language);
}
}
asncodes += "'" + item.ASNCode + item.WorkPoint + "',";
}
if (string.IsNullOrWhiteSpace(asncodes))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo009"));//"请传入送货单信息!");
}
#region 查询返回数据
sql = @"SELECT
n.POCode,
n.Sequence AS POSequence,
a.ASNCode,
a.DNCode,
a.Sequence,
a.VenCode,
a.DepCode,
a.InvCode,
inv.InvName,
inv.InvStd,
a.Quantity,
inv.InvUnit,
a.Amount,
inv.AmountUnit,
a.RCVQuantity,
a.UnitPrice,
a.Currency,
a.POID,
a.PODetailID,
a.DNID,
a.DNDetailID,
ext.ProjectCode,
ext.BatchCode,
ext.Version,
ext.Brand,
ext.cFree1,
ext.cFree2,
ext.cFree3,
ext.cFree4,
ext.cFree5,
ext.cFree6,
ext.cFree7,
ext.cFree8,
ext.cFree9,
ext.cFree10,
a.MUSER AS [User],
a.MTIME AS [MTime]
FROM ICSDeliveryNotice a
INNER JOIN ICSPurchaseOrder n ON a.POID =n.POID AND a.PODetailID=n.PODetailID AND a.WorkPoint=n.WorkPoint
INNER JOIN ICSExtension ext ON a.ExtensionID=ext.ID AND a.WorkPoint=ext.WorkPoint
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
WHERE a.ASNCode+a.WorkPoint IN ({0})";
sql = string.Format(sql, asncodes.Substring(0, asncodes.Length - 1));
DataTable data = DBHelper.SQlReturnData(sql, cmd);
#endregion
cmd.Transaction.Commit();
return data;
}
catch (Exception ex)
{
if (cmd.Transaction != null)
cmd.Transaction.Rollback();
log.Error(ex.Message);
throw new Exception(ex.Message);
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Dispose();
}
}
}
}
}

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

@ -159,148 +159,7 @@ namespace ICSSoft.WebAPI.Controllers
log.Debug("获取层级返回值:" + str);
return result;
}
//#region 委外送货单
///// <summary>
///// 委外送货单查询
///// </summary>
///// <returns></returns>
//[HttpPost]
//[Route("api/AdvancedShipmentNotice/NoticeGet")]
//public HttpResponseMessage NoticeGET([FromBody] object JsonData)
//{
// log.Info("委外送货单信息传入值" + JsonData);
// try
// {
// if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
// {
// OutsourcingModel model = new OutsourcingModel();
// model = JsonConvert.DeserializeObject<OutsourcingModel>(JsonData.ToString());
// OutsourcingSevice action = new OutsourcingSevice();
// OutsourcingModelInfo resultStr = action.Get(model);
// if (resultStr == null)
// {
// res.Success = false;
// res.Message = LanguageHelper.GetNameSingle("WMSAPI003");//"未查询到相关数据!";
// }
// else
// {
// res.Success = true;
// res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
// res.Data = resultStr;
// }
// }
// }
// catch (Exception ex)
// {
// log.Error("转换失败:" + ex.ToString());
// res.Success = false;
// res.Message = ex.Message;
// }
// finally
// {
// str = JsonConvert.SerializeObject(res);
// result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
// }
// log.Debug("委外送货单信息返回值:" + str);
// return result;
//}
//#endregion
///// <summary>
///// 委外送货单添加
///// </summary>
///// <param name="JsonData"></param>
///// <returns></returns>
//[HttpPost]
//[Route("api/AdvancedShipmentNotice/NoticeCreate")]
//public HttpResponseMessage NoticeCreate([FromBody] object JsonData)
//{
// log.Info("委外送货单添加信息传入值" + JsonData);
// try
// {
// if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
// {
// List<NoticeCreateIModel> model = new List<NoticeCreateIModel>();
// model = JsonConvert.DeserializeObject<List<NoticeCreateIModel>>(JsonData.ToString());
// OutsourcingSevice action = new OutsourcingSevice();
// var resultStr = action.Create(model);
// if (resultStr < 0)
// {
// res.Success = false;
// res.Message = LanguageHelper.GetNameSingle("WMSAPI003");//"未查询到相关数据!";
// }
// else
// {
// res.Success = true;
// res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
// res.Data = null;
// }
// }
// }
// catch (Exception ex)
// {
// log.Error("转换失败:" + ex.ToString());
// res.Success = false;
// res.Message = ex.Message;
// }
// finally
// {
// str = JsonConvert.SerializeObject(res);
// result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
// }
// log.Debug("委外送货单信息返回值:" + str);
// return result;
//}
///// <summary>
///// 委外送货单删除
///// </summary>
///// <param name="JsonData"></param>
///// <returns></returns>
//[HttpPost]
//[Route("api/AdvancedShipmentNotice/NoticeDelete")]
//public HttpResponseMessage NoticeDelete([FromBody] object JsonData)
//{
// log.Info("委外送货单删除信息传入值" + JsonData);
// try
// {
// if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
// {
// NoticeDelete model = new NoticeDelete();
// model = JsonConvert.DeserializeObject<NoticeDelete>(JsonData.ToString());
// OutsourcingSevice action = new OutsourcingSevice();
// var resultStr = action.Delete(model);
// if (resultStr == null)
// {
// res.Success = false;
// res.Message = LanguageHelper.GetNameSingle("WMSAPI003");//"未查询到相关数据!";
// }
// else
// {
// res.Success = true;
// res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
// res.Data = resultStr;
// }
// }
// }
// catch (Exception ex)
// {
// log.Error("转换失败:" + ex.ToString());
// res.Success = false;
// res.Message = ex.Message;
// }
// finally
// {
// str = JsonConvert.SerializeObject(res);
// result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
// }
// log.Debug("委外送货单删除信息返回值:" + str);
// return result;
//}
/// <summary>
/// 使用中
/// 获取源头单据信息
@ -930,10 +789,6 @@ namespace ICSSoft.WebAPI.Controllers
{
BarCodeModel model = new BarCodeModel();
model = JsonConvert.DeserializeObject<BarCodeModel>(JsonData.ToString());
//var resultStr = ICSSubmitService.BarCodeInformationGet(model);
//res.Success = true;
//res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
//res.Data = resultStr;
lock (key)
{
res = ICSSubmitService.BarCodeInformationGet(model);
@ -6936,6 +6791,40 @@ namespace ICSSoft.WebAPI.Controllers
return result;
}
[HttpPost]
[Route("api/YSDeliveryNotice/Create")]
public HttpResponseMessage YSDeliveryNoticeCreate([FromBody] object JsonData)
{
log.Info("采购到货传入值" + JsonData);
try
{
List<ICSDeliveryNotice> model = new List<ICSDeliveryNotice>();
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
model = JsonConvert.DeserializeObject<List<ICSDeliveryNotice>>(JsonData.ToString());
var resultStr = ICSSubmitService.DeliveryNoticeCreate(model);
res.Success = true;
res.Message = LanguageHelper.GetNameSingle("WMSAPI001") + "到货单号:" + resultStr.Rows[0]["DNCode"];// "接口调用成功!";
if (resultStr != null && resultStr.Rows.Count > 0 && resultStr.ToString() != "[]")
{
res.Data = resultStr;
}
}
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("采购到货返回值:" + str);
return result;
}
}

4
ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Web.config

@ -8,7 +8,7 @@
<add key="ERPDB" value="UFDATA_999_2019"/>
<!--88-->
<!--<add key="ConnStr" value="Data Source=192.168.1.154;Database=ICSWMS_Base_U9;Uid=sa;Password=tizi@123;" />-->
<!--<add key="ConnStr" value="Data Source=192.168.1.88;Database=ICSWMS_Base;Uid=sa;Password=aA123456;"/>-->
<add key="ConnStr" value="Data Source=192.168.1.88;Database=ICSWMS_Base;Uid=sa;Password=aA123456;"/>
<!--咖博士-->
<!--<add key="ConnStr" value="Data Source=172.66.9.13;Database=ICSWMS_KBS;Uid=sa;Password=Drcoffee201609;" />-->
<!--<add key="ERPUrl" value="http://172.66.9.14:80/api/" />-->
@ -20,7 +20,7 @@
<!--<add key="ConnStr" value="Data Source=117.80.147.228;Database=ICSWMS_Base_SJ;Uid=sa;Password=p@ssw0rd;"/>-->
<!--<add key="ERPUrl" value="http://180.101.177.196:82/api/"/>-->
<!--德易仕-->
<add key="ConnStr" value="Data Source=192.168.10.41;Database=ICSWMS_DYS;Uid=sa;Password=aA123456;" />
<!--<add key="ConnStr" value="Data Source=192.168.10.41;Database=ICSWMS_DYS;Uid=sa;Password=aA123456;" />-->
<add key="FilePath" value="D:\\mesPics\\" />
<add key="ERPUrl" value="http://192.168.1.88:3004/api/" />
<!--<add key="ERPUrl" value="http://192.168.1.155/U9WMS/api/" />-->

Loading…
Cancel
Save