Browse Source

no message

master
陆晔 2 years ago
parent
commit
2bec2ecac9
  1. 4
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
  2. 256
      WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
  3. 4
      WMS-BS/NFine.Web/Configs/database.config

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

@ -1099,7 +1099,7 @@ namespace ICSSoft.DataProject
{
#region 根据单据获得占料信息
string docsql = @"select TransSequence,LotNo,Quantity,InvCode from ICSWareHouseLotInfoLog
where TransCode='{0}' and TransType='15' and WorkPoint='{2}'";
where TransCode='{0}' and TransType='15' and WorkPoint='{1}'";
docsql = string.Format(docsql, TransCode, WorkPoint);
DataTable docdt = DBHelper.SQlReturnData(docsql, cmd);
#endregion
@ -1107,7 +1107,7 @@ namespace ICSSoft.DataProject
{
string INVCode = dr["InvCode"].ToString();
decimal lotQuantity = Convert.ToDecimal(dr["Quantity"]);
string DocLineNO = dr["Sequence"].ToString();
string DocLineNO = dr["TransSequence"].ToString();
string LotNO = dr["LotNo"].ToString();
///更新库存
string sql = @"UPDATE ICSWareHouseLotInfo SET Quantity=ISNULL(Quantity,0)-'{2}' WHERE LotNo='{0}' AND WorkPoint='{1}'";

256
WMS-BS/NFine.Application/WMS/PickMaterialApp.cs

@ -1911,151 +1911,163 @@ c.Sequence,
table.Rows.RemoveAt(item);
}
}
#region 拣料时增加条码出入库记录,修改库存锁定数量,以作占料处理
string BusinessCode = string.Empty;
string TransType = "";
if (Type == "2") { BusinessCode = "13"; TransType = "生产发料-领料申请单"; }
if (Type == "12") { BusinessCode = "14"; TransType = "生产发料-领料申请单"; }
if (Type == "5") { BusinessCode = "6"; TransType = "委外发料-委外领料申请单"; }
if (Type == "7") { BusinessCode = "19"; TransType = "销售发货-销售发货单"; }
if (Type == "8") { BusinessCode = "24"; TransType = "杂发"; }
if (Type == "10") { BusinessCode = "47"; TransType = "调拨申请单"; }
string Identification = Guid.NewGuid().ToString();
var pikTbLogTime = DateTime.Now;
string pikTbLogsql = string.Empty;
List<string> DocNoList = new List<string>();
#region 货柜
string InspectJosn = "";
string InspectJosnHead = "";
string InspectJosnBody = "";
InspectJosn += "{";
InspectJosn += "\"IMP_ORDINI\":[";
InspectJosn += "货柜主表区域预留";
InspectJosn += "],";
InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
InspectJosn += "货柜子表区域预留";
InspectJosn += "]";
InspectJosn += "}";
foreach (DataRow PickLog in table.Rows)
{
string hgsql = @"select A.InvCode,A.LocationCode,B.F_Define3,C.LocationCode AS Area
try
{
#region 拣料时增加条码出入库记录,修改库存锁定数量,以作占料处理
string BusinessCode = string.Empty;
string TransType = "";
if (Type == "2") { BusinessCode = "13"; TransType = "生产发料-领料申请单"; }
if (Type == "12") { BusinessCode = "14"; TransType = "生产发料-领料申请单"; }
if (Type == "5") { BusinessCode = "6"; TransType = "委外发料-委外领料申请单"; }
if (Type == "7") { BusinessCode = "19"; TransType = "销售发货-销售发货单"; }
if (Type == "8") { BusinessCode = "24"; TransType = "杂发"; }
if (Type == "10") { BusinessCode = "47"; TransType = "调拨申请单"; }
string Identification = Guid.NewGuid().ToString();
var pikTbLogTime = DateTime.Now;
string pikTbLogsql = string.Empty;
List<string> DocNoList = new List<string>();
#region 货柜
string InspectJosn = "";
string InspectJosnHead = "";
string InspectJosnBody = "";
InspectJosn += "{";
InspectJosn += "\"IMP_ORDINI\":[";
InspectJosn += "货柜主表区域预留";
InspectJosn += "],";
InspectJosn += "\"IMP_ORDINI_RIGHE\":[";
InspectJosn += "货柜子表区域预留";
InspectJosn += "]";
InspectJosn += "}";
foreach (DataRow PickLog in table.Rows)
{
string hgsql = @"select A.InvCode,A.LocationCode,B.F_Define3,C.LocationCode AS Area
from ICSWareHouseLotInfo A
INNER JOIN Sys_SRM_ItemsDetail B ON B.F_Define2=A.LocationCode AND F_Define4=A.WorkPoint AND F_ItemName='HG_Location'
INNER JOIN ICSInventoryDetail C ON C.INVCode=A.InvCode AND C.WHCode=A.WarehouseCode AND C.WorkPoint=A.WorkPoint
where A.LotNo='{0}' AND A.WorkPoint='{1}'";
hgsql = string.Format(hgsql, PickLog["LotNO"].ToString(), WorkPoint);
var hgds = Repository().FindDataSetBySql(hgsql);
if (hgds.Tables.Count == 0)
return null;
DataTable hgtable = hgds.Tables[0];
if (hgtable.Rows.Count > 0)
{
if (!DocNoList.Contains(PickLog["Code"].ToString()))
hgsql = string.Format(hgsql, PickLog["LotNO"].ToString(), WorkPoint);
var hgds = Repository().FindDataSetBySql(hgsql);
if (hgds.Tables.Count == 0)
return null;
DataTable hgtable = hgds.Tables[0];
if (hgtable.Rows.Count > 0)
{
DocNoList.Add(PickLog["Code"].ToString());
if (!DocNoList.Contains(PickLog["Code"].ToString()))
{
DocNoList.Add(PickLog["Code"].ToString());
}
InspectJosnBody += "{";
InspectJosnBody += "\"RIG_ORDINE\":\"" + PickLog["Code"].ToString() + "\",";
InspectJosnBody += "\"RIG_ARTICOLO\": \"" + hgtable.Rows[0]["InvCode"].ToString() + "\",";
InspectJosnBody += "\"RIG_SUB1\": \"\",";
InspectJosnBody += "\"RIG_SUB2\": \"\",";
InspectJosnBody += "\"RIG_ELERUOLI_GEST\": \"" + hgtable.Rows[0]["Area"].ToString() + "\",";
InspectJosnBody += "\"RIG_ELEBAIE\": \"" + hgtable.Rows[0]["F_Define3"].ToString() + "\",";
InspectJosnBody += "\"RIG_QTAR\": " + PickLog["SendQTY"].ToString() + ",";
InspectJosnBody += "\"RIG_HOSTINF\": \"" + PickLog["Sequence"].ToString() + "\"";
InspectJosnBody += "},";
}
InspectJosnBody += "{";
InspectJosnBody += "\"RIG_ORDINE\":\"" + PickLog["Code"].ToString() + "\",";
InspectJosnBody += "\"RIG_ARTICOLO\": \"" + hgtable.Rows[0]["InvCode"].ToString() + "\",";
InspectJosnBody += "\"RIG_SUB1\": \"\",";
InspectJosnBody += "\"RIG_SUB2\": \"\",";
InspectJosnBody += "\"RIG_ELERUOLI_GEST\": \"" + hgtable.Rows[0]["Area"].ToString() + "\",";
InspectJosnBody += "\"RIG_ELEBAIE\": \"" + hgtable.Rows[0]["F_Define3"].ToString() + "\",";
InspectJosnBody += "\"RIG_QTAR\": " + PickLog["SendQTY"].ToString() + ",";
InspectJosnBody += "\"RIG_HOSTINF\": \"" + PickLog["Sequence"].ToString() + "\"";
InspectJosnBody += "},";
}
}
InspectJosnBody.TrimEnd(',');
foreach (string DocNo in DocNoList)
{
InspectJosnHead += "{";
InspectJosnHead += "\"ORD_ORDINE\":\"" + DocNo.TrimStart('\'').TrimEnd('\'') + "\",";
InspectJosnHead += "\"ORD_DES\":\"" + TransType + "\",";
InspectJosnHead += "\"ORD_TIPOOP\":\"P\",";
InspectJosnHead += "\"ORD_CLIENTE\":\"" + WorkPoint + "\"";
InspectJosnHead += "},";
}
InspectJosnHead.TrimEnd(',');
if (InspectJosnBody != "")
{
InspectJosn = InspectJosn.Replace("货柜主表区域预留", InspectJosnHead);
InspectJosn = InspectJosn.Replace("货柜子表区域预留", InspectJosnBody);
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
{
string callresult = "";
#region 货柜接口调用前日志
object logID = Guid.NewGuid();
string logsql = @"insert into ICSWMS_HGLog
}
InspectJosnBody.TrimEnd(',');
foreach (string DocNo in DocNoList)
{
InspectJosnHead += "{";
InspectJosnHead += "\"ORD_ORDINE\":\"" + DocNo.TrimStart('\'').TrimEnd('\'') + "\",";
InspectJosnHead += "\"ORD_DES\":\"" + TransType + "\",";
InspectJosnHead += "\"ORD_TIPOOP\":\"P\",";
InspectJosnHead += "\"ORD_CLIENTE\":\"" + WorkPoint + "\"";
InspectJosnHead += "},";
}
InspectJosnHead.TrimEnd(',');
if (InspectJosnBody != "")
{
InspectJosn = InspectJosn.Replace("货柜主表区域预留", InspectJosnHead);
InspectJosn = InspectJosn.Replace("货柜子表区域预留", InspectJosnBody);
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadERP"]))
{
string callresult = "";
#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
callresult = 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
callresult = HTTPHelper.RestFulGet(InspectJosn, postUrlStr);
#region 货柜接口调用后日志
logsql = @"update ICSWMS_HGLog set ReturnResult='{0}'
where ID='{1}'";
logsql = string.Format(logsql, callresult, logID);
SqlHelper.CmdExecuteNonQueryLi(logsql);
#endregion
//if (!callresult.Contains("successo"))
//{
// ICSHGResult hgresult = JsonConvert.DeserializeObject<ICSHGResult>(callresult.TrimStart('[').TrimEnd(']'));
// throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + "");
//}
logsql = string.Format(logsql, callresult, logID);
SqlHelper.CmdExecuteNonQueryLi(logsql);
#endregion
//if (!callresult.Contains("successo"))
//{
// ICSHGResult hgresult = JsonConvert.DeserializeObject<ICSHGResult>(callresult.TrimStart('[').TrimEnd(']'));
// throw new Exception("货柜单据传输接口调用报错,主要报错信息:" + hgresult.PrimaryError + ",次要报错信息:" + hgresult.SecondaryError + "");
//}
}
}
}
#endregion
foreach (DataRow PickLog in table.Rows)
{
pikTbLogsql += @"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)
SELECT NEWID(),'{0}','{1}','{2}',a.LotNo ,a.InvCode ,
a.WarehouseCode,a.LocationCode,'','','{3}',
'','1','15','{4}','0','',
'','','','{5}' ,'{6}' ,
'{7}' ,'{8}' ,''
FROM ICSWareHouseLotInfo a
WHERE a.LotNo='{9}' AND a.WorkPoint='{8}' ";
pikTbLogsql += @"update ICSWareHouseLotInfo set LockQuantity=LockQuantity+'{3}' where LotNo='{9}' ";
pikTbLogsql = string.Format(pikTbLogsql, Identification, PickLog["Code"].ToString(), PickLog["Sequence"].ToString(), PickLog["SendQTY"].ToString(), BusinessCode, MUSER, MUSERNAME, pikTbLogTime, WorkPoint, PickLog["LotNO"].ToString());
}
SqlHelper.CmdExecuteNonQueryLi(pikTbLogsql);
#endregion
foreach (DataRow PickLog in table.Rows)
{
pikTbLogsql += @" IF NOT EXISTS(SELECT TransCode FROM ICSWareHouseLotInfoLog WHERE TransCode='{1}' AND TransSequence='{2}' AND LotNo='{9}' AND WorkPoint='{8}' AND TransType='15')
BEGIN
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)
SELECT NEWID(),'{0}','{1}','{2}',a.LotNo ,a.InvCode ,
a.WarehouseCode,a.LocationCode,'','','{3}',
'','1','15','{4}','0','',
'','','','{5}' ,'{6}' ,
'{7}' ,'{8}' ,''
FROM ICSWareHouseLotInfo a
WHERE a.LotNo='{9}' AND a.WorkPoint='{8}'
update ICSWareHouseLotInfo set LockQuantity=LockQuantity+'{3}' where LotNo='{9}' AND WorkPoint='{8}'
END ";
pikTbLogsql = string.Format(pikTbLogsql, Identification, PickLog["Code"].ToString(), PickLog["Sequence"].ToString(), PickLog["SendQTY"].ToString()
, BusinessCode, MUSER, MUSERNAME, pikTbLogTime, WorkPoint, PickLog["LotNO"].ToString());
}
SqlHelper.CmdExecuteNonQueryLi(pikTbLogsql);
#endregion
#endregion
#region 将拣料结果存入表中,以人员区分,每次存入之前清空对应人员存入的数据
#region 将拣料结果存入表中,以人员区分,每次存入之前清空对应人员存入的数据
string picksql = @"delete from ICSPickPrintTemp
string picksql = @"delete from ICSPickPrintTemp
where MUSER='{0}' AND WorkPoint='{1}'";
picksql = string.Format(picksql, MUSER, WorkPoint);
SqlHelper.ExecuteNonQuery(picksql);
picksql = "";
foreach (DataRow pickdr in table.Rows)
{
picksql += @" INSERT INTO ICSPickPrintTemp
picksql = string.Format(picksql, MUSER, WorkPoint);
SqlHelper.ExecuteNonQuery(picksql);
picksql = "";
foreach (DataRow pickdr in table.Rows)
{
picksql += @" INSERT INTO ICSPickPrintTemp
(ID,DocNO,INVCode,iQuantity,WHCode,BinCode,LotNO,QTYTotal,SendQTY,MUSER,MUSERNAME,WorkPoint)
VALUES
(NEWID(),'{0}','{1}',{2},'{3}','{4}','{5}',{6},{7},'{8}','{9}','{10}')";
picksql = string.Format(picksql, pickdr["Code"].ToString(), pickdr["InvCode"].ToString(), Convert.ToDecimal(pickdr["iQuantity"])
, pickdr["WarehouseCode"].ToString(), pickdr["LocationCode"].ToString(), pickdr["LotNO"].ToString()
, Convert.ToDecimal(pickdr["QTYTotal"]), Convert.ToDecimal(pickdr["SendQTY"]), MUSER, MUSERNAME, WorkPoint);
picksql = string.Format(picksql, pickdr["Code"].ToString(), pickdr["InvCode"].ToString(), Convert.ToDecimal(pickdr["iQuantity"])
, pickdr["WarehouseCode"].ToString(), pickdr["LocationCode"].ToString(), pickdr["LotNO"].ToString()
, Convert.ToDecimal(pickdr["QTYTotal"]), Convert.ToDecimal(pickdr["SendQTY"]), MUSER, MUSERNAME, WorkPoint);
}
SqlHelper.ExecuteNonQuery(picksql);
#endregion
var result = ConvertCellToString(table);
if (Invmes.Rows.Count > 0)
{
result.Merge(Invmes, false);
}
return result;
}
SqlHelper.ExecuteNonQuery(picksql);
#endregion
var result = ConvertCellToString(table);
if (Invmes.Rows.Count > 0)
catch (Exception ex)
{
result.Merge(Invmes, false);
throw new Exception(ex.Message);
}
return result;
}
/// <summary>

4
WMS-BS/NFine.Web/Configs/database.config

@ -5,9 +5,9 @@
<!--108-->
<!--<add name="connstr" connectionString="JZjXxiMt8L2hkBlLUD8PBo2VxWR5j1mbj0xyJuwPqY46ywhO56rsfUcuYrySELpMcIISP9ZsoeoRM35Azqruwa16sHbPpvUnLjcXO9dQBsCb0fkixsVZhA==" providerName="System.Data.SqlClient" />-->
<!--本地-->
<add name="connstr" connectionString="terx6nSzhBu3PkkAnpCSyozL3WzAB9fHjBxO0NVXmpe6eOA9kowv/TJOuTy7IT8nOsne+r4F4sCVTYdtU25qsA==" providerName="System.Data.SqlClient" />
<!--<add name="connstr" connectionString="terx6nSzhBu3PkkAnpCSyozL3WzAB9fHjBxO0NVXmpe6eOA9kowv/TJOuTy7IT8nOsne+r4F4sCVTYdtU25qsA==" providerName="System.Data.SqlClient" />-->
<!--正式-->
<!--<add name="connstr" connectionString="rtGBmI26IovLyEon0NvnkIdIGtERsck4MvG2wvfMHc6XnoqSx8xp4zCTtW6J8SL4+zTBRPXBbFQ4AEnn281E5TY7A1IZOMIr" providerName="System.Data.SqlClient" />-->
<add name="connstr" connectionString="rtGBmI26IovLyEon0NvnkIdIGtERsck4MvG2wvfMHc6XnoqSx8xp4zCTtW6J8SL4+zTBRPXBbFQ4AEnn281E5TY7A1IZOMIr" providerName="System.Data.SqlClient" />
<add name="ERPconnstr" connectionString="Server=192.168.1.218;Initial Catalog=ICS_WMS_NW;User ID=sa;Password=aA123456" providerName="System.Data.SqlClient" />
<add name="ATVERPconnstr" connectionString="Server=10.29.2.71;Initial Catalog=ATW-0717;User ID=sa;Password=atw.erp" providerName="System.Data.SqlClient" />
<add name="MailOpen" connectionString="true" />

Loading…
Cancel
Save