|
|
@ -2748,181 +2748,188 @@ CAST( (a.Quantity-ISNULL(c.LOTQTY,0)) as DECIMAL(18,{0})) as thisCreateQty,isnu |
|
|
|
} |
|
|
|
|
|
|
|
//单据上传货柜
|
|
|
|
public string DocUpLoadToHG(string DocNoList,string Type, string WorkPoint) |
|
|
|
public string DocUpLoadToHG(string DocNoList,string Type) |
|
|
|
{ |
|
|
|
string postUrlStr = System.Configuration.ConfigurationManager.AppSettings["HGDocpostUrlStr"].ToString(); |
|
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; |
|
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; |
|
|
|
string WorkPoints = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); |
|
|
|
string DocNoInfo = DocNoList.TrimEnd(','); |
|
|
|
|
|
|
|
string InspectJosn = ""; |
|
|
|
#region 检验合格单
|
|
|
|
if (Type == "7") |
|
|
|
try |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"IMP_ORDINI\":["; |
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
string postUrlStr = System.Configuration.ConfigurationManager.AppSettings["HGDocpostUrlStr"].ToString(); |
|
|
|
string MUSER = NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode; |
|
|
|
string MUSERNAME = NFine.Code.OperatorProvider.Provider.GetCurrent().UserName; |
|
|
|
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); |
|
|
|
string DocNoInfo = DocNoList.TrimEnd(','); |
|
|
|
|
|
|
|
string InspectJosn = ""; |
|
|
|
#region 检验合格单
|
|
|
|
if (Type == "7") |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"ORD_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"ORD_DES\":\"采购入库-采购到货单\","; |
|
|
|
InspectJosn += "\"ORD_TIPOOP\":\"V\","; |
|
|
|
InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "],"; |
|
|
|
InspectJosn += "\"IMP_ORDINI_RIGHE\":["; |
|
|
|
InspectJosn += "\"IMP_ORDINI\":["; |
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"ORD_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"ORD_DES\":\"采购入库-采购到货单\","; |
|
|
|
InspectJosn += "\"ORD_TIPOOP\":\"V\","; |
|
|
|
InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "],"; |
|
|
|
InspectJosn += "\"IMP_ORDINI_RIGHE\":["; |
|
|
|
|
|
|
|
|
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
string sql = @" select A.DNCode,A.Sequence,A.InvCode,A.Quantity,B.LocationCode AS Area from ICSDeliveryNotice A
|
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
string sql = @" select A.DNCode,A.Sequence,A.InvCode,A.Quantity,B.LocationCode AS Area from ICSDeliveryNotice A
|
|
|
|
INNER JOIN ICSInventoryDetail B ON B.WHCode=A.WHCode AND B.INVCode=A.InvCode AND B.WorkPoint=A.WorkPoint |
|
|
|
where A.DNCode='{0}' and A.WorkPoint='{1}'";
|
|
|
|
sql = string.Format(sql, DocNO, WorkPoint); |
|
|
|
DataTable dt = Repository().FindTableBySql(sql.ToString()); |
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
{ |
|
|
|
//RIG_ELERUOLI_GEST-区域-出入库都要
|
|
|
|
//RIG_ELEBAIE-机器出口-出库-出库才要
|
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"RIG_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"RIG_ARTICOLO\": \"" + dt.Rows[i]["InvCode"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_SUB1\": \"\","; |
|
|
|
InspectJosn += "\"RIG_SUB2\": \"\","; |
|
|
|
InspectJosn += "\"RIG_ELERUOLI_GEST\": \"" + dt.Rows[i]["Area"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_QTAR\": " + dt.Rows[i]["Quantity"].ToString() + ","; |
|
|
|
InspectJosn += "\"RIG_HOSTINF\": " + dt.Rows[i]["Sequence"].ToString() + ""; |
|
|
|
InspectJosn += "},"; |
|
|
|
sql = string.Format(sql, DocNO, WorkPoint); |
|
|
|
DataTable dt = Repository().FindTableBySql(sql.ToString()); |
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
{ |
|
|
|
//RIG_ELERUOLI_GEST-区域-出入库都要
|
|
|
|
//RIG_ELEBAIE-机器出口-出库-出库才要
|
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"RIG_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"RIG_ARTICOLO\": \"" + dt.Rows[i]["InvCode"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_SUB1\": \"\","; |
|
|
|
InspectJosn += "\"RIG_SUB2\": \"\","; |
|
|
|
InspectJosn += "\"RIG_ELERUOLI_GEST\": \"" + dt.Rows[i]["Area"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_QTAR\": " + dt.Rows[i]["Quantity"].ToString() + ","; |
|
|
|
InspectJosn += "\"RIG_HOSTINF\": " + dt.Rows[i]["Sequence"].ToString() + ""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "]"; |
|
|
|
InspectJosn += "}"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "]"; |
|
|
|
InspectJosn += "}"; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 机加工成品入库单
|
|
|
|
if (Type == "9") |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"IMP_ORDINI\":["; |
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
#region 机加工成品入库单
|
|
|
|
if (Type == "9") |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"ORD_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"ORD_DES\":\"产成品入库-产成品入库单\","; |
|
|
|
InspectJosn += "\"ORD_TIPOOP\":\"V\","; |
|
|
|
InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "],"; |
|
|
|
InspectJosn += "\"IMP_ORDINI_RIGHE\":["; |
|
|
|
InspectJosn += "\"IMP_ORDINI\":["; |
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"ORD_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"ORD_DES\":\"产成品入库-产成品入库单\","; |
|
|
|
InspectJosn += "\"ORD_TIPOOP\":\"V\","; |
|
|
|
InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "],"; |
|
|
|
InspectJosn += "\"IMP_ORDINI_RIGHE\":["; |
|
|
|
|
|
|
|
|
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
string sql = @" select A.RCVCode,A.Sequence,A.InvCode,A.Quantity,B.LocationCode AS Area from ICSManufactureReceive A
|
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
string sql = @" select A.RCVCode,A.Sequence,A.InvCode,A.Quantity,B.LocationCode AS Area from ICSManufactureReceive A
|
|
|
|
INNER JOIN ICSInventoryDetail B ON B.WHCode=A.WHCode AND B.INVCode=A.InvCode AND B.WorkPoint=A.WorkPoint |
|
|
|
where A.RCVCode='{0}' and A.WorkPoint='{1}'";
|
|
|
|
sql = string.Format(sql, DocNO, WorkPoint); |
|
|
|
DataTable dt = Repository().FindTableBySql(sql.ToString()); |
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
{ |
|
|
|
//RIG_ELERUOLI_GEST-区域-出入库都要
|
|
|
|
//RIG_ELEBAIE-机器出口-出库-出库才要
|
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"RIG_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"RIG_ARTICOLO\": \"" + dt.Rows[i]["InvCode"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_SUB1\": \"\","; |
|
|
|
InspectJosn += "\"RIG_SUB2\": \"\","; |
|
|
|
InspectJosn += "\"RIG_ELERUOLI_GEST\": \"" + dt.Rows[i]["Area"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_QTAR\": " + dt.Rows[i]["Quantity"].ToString() + ","; |
|
|
|
InspectJosn += "\"RIG_HOSTINF\": " + dt.Rows[i]["Sequence"].ToString() + ""; |
|
|
|
InspectJosn += "},"; |
|
|
|
sql = string.Format(sql, DocNO, WorkPoint); |
|
|
|
DataTable dt = Repository().FindTableBySql(sql.ToString()); |
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
{ |
|
|
|
//RIG_ELERUOLI_GEST-区域-出入库都要
|
|
|
|
//RIG_ELEBAIE-机器出口-出库-出库才要
|
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"RIG_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"RIG_ARTICOLO\": \"" + dt.Rows[i]["InvCode"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_SUB1\": \"\","; |
|
|
|
InspectJosn += "\"RIG_SUB2\": \"\","; |
|
|
|
InspectJosn += "\"RIG_ELERUOLI_GEST\": \"" + dt.Rows[i]["Area"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_QTAR\": " + dt.Rows[i]["Quantity"].ToString() + ","; |
|
|
|
InspectJosn += "\"RIG_HOSTINF\": " + dt.Rows[i]["Sequence"].ToString() + ""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "]"; |
|
|
|
InspectJosn += "}"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "]"; |
|
|
|
InspectJosn += "}"; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 生产退料单
|
|
|
|
if (Type == "12") |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"IMP_ORDINI\":["; |
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
#region 生产退料单
|
|
|
|
if (Type == "12") |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"ORD_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"ORD_DES\":\"生产退料-生产退料单-领料申请单\","; |
|
|
|
InspectJosn += "\"ORD_TIPOOP\":\"V\","; |
|
|
|
InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "],"; |
|
|
|
InspectJosn += "\"IMP_ORDINI_RIGHE\":["; |
|
|
|
InspectJosn += "\"IMP_ORDINI\":["; |
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"ORD_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"ORD_DES\":\"生产退料-生产退料单-领料申请单\","; |
|
|
|
InspectJosn += "\"ORD_TIPOOP\":\"V\","; |
|
|
|
InspectJosn += "\"ORD_CLIENTE\":\"" + WorkPoint + "\""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "],"; |
|
|
|
InspectJosn += "\"IMP_ORDINI_RIGHE\":["; |
|
|
|
|
|
|
|
|
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
string sql = @" select A.ApplyNegCode,B.Sequence,B.InvCode,B.Quantity,C.LocationCode AS Area from ICSMOApplyNeg A
|
|
|
|
foreach (string DocNO in DocNoInfo.Split(',')) |
|
|
|
{ |
|
|
|
string sql = @" select A.ApplyNegCode,B.Sequence,B.InvCode,B.Quantity,C.LocationCode AS Area from ICSMOApplyNeg A
|
|
|
|
INNER JOIN ICSMOApplyNegDetail B ON B.ApplyNegCode=A.ApplyNegCode AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryDetail C ON C.WHCode=B.WHCode AND C.INVCode=B.InvCode AND C.WorkPoint=B.WorkPoint |
|
|
|
where A.ApplyNegCode='{0}' and A.WorkPoint='{1}'";
|
|
|
|
sql = string.Format(sql, DocNO, WorkPoint); |
|
|
|
DataTable dt = Repository().FindTableBySql(sql.ToString()); |
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
{ |
|
|
|
//RIG_ELERUOLI_GEST-区域-出入库都要
|
|
|
|
//RIG_ELEBAIE-机器出口-出库-出库才要
|
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"RIG_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"RIG_ARTICOLO\": \"" + dt.Rows[i]["InvCode"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_SUB1\": \"\","; |
|
|
|
InspectJosn += "\"RIG_SUB2\": \"\","; |
|
|
|
InspectJosn += "\"RIG_ELERUOLI_GEST\": \"" + dt.Rows[i]["Area"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_QTAR\": " + dt.Rows[i]["Quantity"].ToString() + ","; |
|
|
|
InspectJosn += "\"RIG_HOSTINF\": " + dt.Rows[i]["Sequence"].ToString() + ""; |
|
|
|
InspectJosn += "},"; |
|
|
|
sql = string.Format(sql, DocNO, WorkPoint); |
|
|
|
DataTable dt = Repository().FindTableBySql(sql.ToString()); |
|
|
|
for (int i = 0; i < dt.Rows.Count; i++) |
|
|
|
{ |
|
|
|
//RIG_ELERUOLI_GEST-区域-出入库都要
|
|
|
|
//RIG_ELEBAIE-机器出口-出库-出库才要
|
|
|
|
InspectJosn += "{"; |
|
|
|
InspectJosn += "\"RIG_ORDINE\":\"" + DocNO + "\","; |
|
|
|
InspectJosn += "\"RIG_ARTICOLO\": \"" + dt.Rows[i]["InvCode"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_SUB1\": \"\","; |
|
|
|
InspectJosn += "\"RIG_SUB2\": \"\","; |
|
|
|
InspectJosn += "\"RIG_ELERUOLI_GEST\": \"" + dt.Rows[i]["Area"].ToString() + "\","; |
|
|
|
InspectJosn += "\"RIG_QTAR\": " + dt.Rows[i]["Quantity"].ToString() + ","; |
|
|
|
InspectJosn += "\"RIG_HOSTINF\": " + dt.Rows[i]["Sequence"].ToString() + ""; |
|
|
|
InspectJosn += "},"; |
|
|
|
} |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "]"; |
|
|
|
InspectJosn += "}"; |
|
|
|
} |
|
|
|
InspectJosn = InspectJosn.TrimEnd(','); |
|
|
|
InspectJosn += "]"; |
|
|
|
InspectJosn += "}"; |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
string result = ""; |
|
|
|
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"])) |
|
|
|
{ |
|
|
|
#region 货柜接口调用前日志
|
|
|
|
object logID = Guid.NewGuid(); |
|
|
|
string logsql = @"insert into ICSWMS_HGLog
|
|
|
|
#endregion
|
|
|
|
string result = ""; |
|
|
|
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"])) |
|
|
|
{ |
|
|
|
#region 货柜接口调用前日志
|
|
|
|
object logID = Guid.NewGuid(); |
|
|
|
string logsql = @"insert into ICSWMS_HGLog
|
|
|
|
values |
|
|
|
('{0}',GETDATE(),'{1}','{2}','{3}','{4}','{5}')";
|
|
|
|
logsql = string.Format(logsql, logID, InspectJosn, "", WorkPoint, MUSER, MUSERNAME); |
|
|
|
SqlHelper.CmdExecuteNonQueryLi(logsql); |
|
|
|
#endregion
|
|
|
|
result = HTTPHelper.RestFulGet(InspectJosn, postUrlStr); |
|
|
|
#region 货柜接口调用后日志
|
|
|
|
logsql = @"update ICSWMS_HGLog set ReturnResult='{0}'
|
|
|
|
logsql = string.Format(logsql, logID, InspectJosn, "", WorkPoint, MUSER, MUSERNAME); |
|
|
|
SqlHelper.CmdExecuteNonQueryLi(logsql); |
|
|
|
#endregion
|
|
|
|
result = HTTPHelper.RestFulGet(InspectJosn, postUrlStr); |
|
|
|
#region 货柜接口调用后日志
|
|
|
|
logsql = @"update ICSWMS_HGLog set ReturnResult='{0}'
|
|
|
|
where ID='{1}'";
|
|
|
|
logsql = string.Format(logsql, result, logID); |
|
|
|
SqlHelper.CmdExecuteNonQueryLi(logsql); |
|
|
|
#endregion
|
|
|
|
if (!result.Contains("successo")) |
|
|
|
{ |
|
|
|
ICSHGResult hgresult = JsonConvert.DeserializeObject<ICSHGResult>(result.TrimStart('[').TrimEnd(']')); |
|
|
|
throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + ""); |
|
|
|
logsql = string.Format(logsql, result, logID); |
|
|
|
SqlHelper.CmdExecuteNonQueryLi(logsql); |
|
|
|
#endregion
|
|
|
|
if (!result.Contains("successo")) |
|
|
|
{ |
|
|
|
ICSHGResult hgresult = JsonConvert.DeserializeObject<ICSHGResult>(result.TrimStart('[').TrimEnd(']')); |
|
|
|
throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + ""); |
|
|
|
} |
|
|
|
} |
|
|
|
return ""; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
return ex.Message; |
|
|
|
} |
|
|
|
return ""; |
|
|
|
} |
|
|
|
|
|
|
|
public object GetDecimalDigits() |
|
|
|
xxxxxxxxxx