|
@ -2037,6 +2037,88 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in |
|
|
Result result = new Result(); |
|
|
Result result = new Result(); |
|
|
result = JsonConvert.DeserializeObject<Result>(resultStr); |
|
|
result = JsonConvert.DeserializeObject<Result>(resultStr); |
|
|
if (result.Success) |
|
|
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 |
|
|
try |
|
|
{ |
|
|
{ |
|
@ -2078,5 +2160,7 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |