|
|
@ -2946,42 +2946,42 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
throw new Exception("容器:" + ContainerCode + "与条码:" + LotNo + "绑定失败!"); |
|
|
|
} |
|
|
|
if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadForkLift"])) |
|
|
|
{ |
|
|
|
string ForkLiftUrl = System.Configuration.ConfigurationManager.AppSettings["ForkLiftUrl"]; |
|
|
|
string Year = DateTime.Now.Year.ToString(); |
|
|
|
string Month = DateTime.Now.Month.ToString().PadLeft(2, '0'); |
|
|
|
string Day = DateTime.Now.Day.ToString().PadLeft(2, '0'); |
|
|
|
string Hour = DateTime.Now.Hour.ToString().PadLeft(2, '0'); |
|
|
|
string Minute = DateTime.Now.Minute.ToString().PadLeft(2, '0'); |
|
|
|
string Second = DateTime.Now.Second.ToString().PadLeft(2, '0'); |
|
|
|
string InspectJosn = "{"; |
|
|
|
InspectJosn += "\"ID\":\"" + Year + Month + Day + Hour + Minute + Second + "\","; |
|
|
|
InspectJosn += "\"PalletID\": \"" + ContainerCode + "\","; |
|
|
|
InspectJosn += "\"LaneCode\": \"\","; |
|
|
|
InspectJosn += "\"TaskType\": \"PTWY\","; |
|
|
|
InspectJosn += "\"SourceBin\": \"\","; |
|
|
|
InspectJosn += "\"DestBin\": \"" + RecomendBinCode + "\""; |
|
|
|
InspectJosn += "}"; |
|
|
|
RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST); |
|
|
|
rest.PostData = InspectJosn; |
|
|
|
string strResult = rest.MakeRequest(); |
|
|
|
//string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn);
|
|
|
|
ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(strResult); |
|
|
|
if (result.Ret == 1) |
|
|
|
{ |
|
|
|
sql = @"update ICSContainer set LocationCode='{2}',EATTRIBUTE1='已搬运' where ContainerCode='{0}' AND WorkPoint='{1}'"; |
|
|
|
sql = string.Format(sql, ContainerCode, WorkPoint, LocationCode); |
|
|
|
if (!DBHelper.ExecuteNonQuery(sql, cmd)) |
|
|
|
{ |
|
|
|
throw new Exception(language.GetNameByCode("WMSAPIInfo207"));//料架状态更新失败
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw new Exception(result.RetMsg); |
|
|
|
} |
|
|
|
} |
|
|
|
//if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["UploadForkLift"]))
|
|
|
|
//{
|
|
|
|
// string ForkLiftUrl = System.Configuration.ConfigurationManager.AppSettings["ForkLiftUrl"];
|
|
|
|
// string Year = DateTime.Now.Year.ToString();
|
|
|
|
// string Month = DateTime.Now.Month.ToString().PadLeft(2, '0');
|
|
|
|
// string Day = DateTime.Now.Day.ToString().PadLeft(2, '0');
|
|
|
|
// string Hour = DateTime.Now.Hour.ToString().PadLeft(2, '0');
|
|
|
|
// string Minute = DateTime.Now.Minute.ToString().PadLeft(2, '0');
|
|
|
|
// string Second = DateTime.Now.Second.ToString().PadLeft(2, '0');
|
|
|
|
// string InspectJosn = "{";
|
|
|
|
// InspectJosn += "\"ID\":\"" + Year + Month + Day + Hour + Minute + Second + "\",";
|
|
|
|
// InspectJosn += "\"PalletID\": \"" + ContainerCode + "\",";
|
|
|
|
// InspectJosn += "\"LaneCode\": \"\",";
|
|
|
|
// InspectJosn += "\"TaskType\": \"PTWY\",";
|
|
|
|
// InspectJosn += "\"SourceBin\": \"\",";
|
|
|
|
// InspectJosn += "\"DestBin\": \"" + RecomendBinCode + "\"";
|
|
|
|
// InspectJosn += "}";
|
|
|
|
// RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST);
|
|
|
|
// rest.PostData = InspectJosn;
|
|
|
|
// string strResult = rest.MakeRequest();
|
|
|
|
// //string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn);
|
|
|
|
// ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(strResult);
|
|
|
|
// if (result.Ret == 1)
|
|
|
|
// {
|
|
|
|
// sql = @"update ICSContainer set LocationCode='{2}',EATTRIBUTE1='已搬运' where ContainerCode='{0}' AND WorkPoint='{1}'";
|
|
|
|
// sql = string.Format(sql, ContainerCode, WorkPoint, LocationCode);
|
|
|
|
// if (!DBHelper.ExecuteNonQuery(sql, cmd))
|
|
|
|
// {
|
|
|
|
// throw new Exception(language.GetNameByCode("WMSAPIInfo207"));//料架状态更新失败
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// throw new Exception(result.RetMsg);
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
} |
|
|
|
//else
|
|
|
|
//{
|
|
|
@ -3192,18 +3192,26 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
string sql = @"select Define1 from Sys_EnumValues
|
|
|
|
where EnumKey='00011' AND EnumText='{0}' AND WorkPointCode='{1}'";
|
|
|
|
sql = string.Format(sql, LocationCode, WorkPoint); |
|
|
|
DataTable dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
{ |
|
|
|
return ""; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return dt.Rows[0]["Define1"].ToString(); |
|
|
|
} |
|
|
|
//string sql = @" select TOP 1 B.LotNo from ICSContainer A
|
|
|
|
// INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint
|
|
|
|
// ORDER BY B.MTIME DESC";
|
|
|
|
//sql = string.Format(sql, LocationCode, WorkPoint);
|
|
|
|
//DataTable dt = DBHelper.SQlReturnData(sql, cmd);
|
|
|
|
//if (dt.Rows.Count == 0)
|
|
|
|
//{
|
|
|
|
// return "";
|
|
|
|
//}
|
|
|
|
//else
|
|
|
|
//{
|
|
|
|
// sql = @"SELECT A.WHCode,C.LocationCode FROM ICSDeliveryNotice A
|
|
|
|
// INNER JOIN ICSInventoryLotDetail B ON B.TransCode=A.DNCode AND B.TransSequence=A.Sequence AND B.WorkPoint=A.WorkPoint
|
|
|
|
// INNER JOIN ICSInventoryDetail C ON C.INVCode=A.InvCode AND C.WHCode=A.WHCode AND C.WorkPoint=A.WorkPoint
|
|
|
|
// WHERE B.LotNo='{0}' AND B.WorkPoint='{1}'";
|
|
|
|
// sql = string.Format(sql, dt.Rows[0]["LotNo"].ToString(), WorkPoint);
|
|
|
|
|
|
|
|
// return dt.Rows[0]["Define1"].ToString();
|
|
|
|
//}
|
|
|
|
return "S02"; |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
@ -3275,7 +3283,7 @@ namespace ICSSoft.DataProject |
|
|
|
{ |
|
|
|
OverLoad = true; |
|
|
|
} |
|
|
|
ContainerCode = dt.Rows[0]["IsOverLoad"].ToString(); |
|
|
|
ContainerCode = dt.Rows[0]["ContainerCode"].ToString(); |
|
|
|
#region 查询料架中条码对应单据的仓库及条码对应物料的区域(绑定时已做卡控,一个料架只能绑定同仓库区域的条码,故只要通过其中一个条码来判断)
|
|
|
|
sql = @"SELECT C.WHCode,C.LocationCode FROM ICSInventoryLotDetail A
|
|
|
|
INNER JOIN ICSDeliveryNotice B ON B.DNCode=A.TransCode AND B.Sequence=A.TransSequence AND B.WorkPoint=A.WorkPoint |
|
|
@ -3328,7 +3336,14 @@ namespace ICSSoft.DataProject |
|
|
|
where B.LocationCode IS NULL AND A.LocationCode like ('{0}'+'-'+'{1}%') AND ISNULL(A.EATTRIBUTE1,'')='' |
|
|
|
AND A.LocationCode NOT IN ({2}) |
|
|
|
ORDER BY A.LocationCode";
|
|
|
|
sql = string.Format(sql, InWHCode, InLocationCode, LocationIsTaken); |
|
|
|
if (LocationIsTaken == "") |
|
|
|
{ |
|
|
|
sql = string.Format(sql, InWHCode, InLocationCode, "''"); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
sql = string.Format(sql, InWHCode, InLocationCode, LocationIsTaken); |
|
|
|
} |
|
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (dt.Rows.Count == 0) |
|
|
|
{ |
|
|
@ -3348,17 +3363,16 @@ namespace ICSSoft.DataProject |
|
|
|
string TaskCode = DBHelper.SQlReturnData(serialsql, cmd).Rows[0][0].ToString(); |
|
|
|
string SerialNum = DateTime.Now.Hour.ToString().PadLeft(2, '0'); |
|
|
|
string InspectJosn = "{"; |
|
|
|
InspectJosn += "\"ID\":\"" + TaskCode + "\",";//任务编号
|
|
|
|
InspectJosn += "\"TaskID\":\"" + TaskCode + "\",";//任务编号
|
|
|
|
InspectJosn += "\"PalletID\": \"" + ContainerCode + "\",";//料架号
|
|
|
|
//InspectJosn += "\"LaneCode\": \"\",";
|
|
|
|
InspectJosn += "\"TaskType\": \"PTWY\",";//任务类型
|
|
|
|
InspectJosn += "\"SourceBin\": \"" + currentPositionCode + "\",";//起始点位
|
|
|
|
InspectJosn += "\"DestBin\": \"" + dt.Rows[0]["LocationCode"].ToString() + "\"";//目标点位
|
|
|
|
InspectJosn += "}"; |
|
|
|
RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST); |
|
|
|
rest.PostData = InspectJosn; |
|
|
|
string strResult = rest.MakeRequest(); |
|
|
|
//string resultstr = HTTPHelper.Post(ERPUrl.AGVBineURL, InspectJosn);
|
|
|
|
//RestHelper rest = new RestHelper(ForkLiftUrl, HttpVerb.POST);
|
|
|
|
//rest.PostData = InspectJosn;
|
|
|
|
string strResult = HTTPHelper.Post(ForkLiftUrl, InspectJosn); |
|
|
|
ForkLiftResult result = JsonConvert.DeserializeObject<ForkLiftResult>(strResult); |
|
|
|
if (result.Ret == 1) |
|
|
|
{ |
|
|
@ -3519,13 +3533,13 @@ namespace ICSSoft.DataProject |
|
|
|
|
|
|
|
#region 根据条码获取入库单据信息
|
|
|
|
string chksql = @"select COUNT(B.LotNo) AS LotCount from ICSContainer A
|
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint |
|
|
|
WHERE ContainerCode='{0}'";
|
|
|
|
chksql = string.Format(chksql, ContainerCode); |
|
|
|
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd); |
|
|
|
sql = @"select E.DNCode AS TransNO,E.Sequence AS TransLine,C.LotNo,C.Quantity,'采购入库' AS DocType
|
|
|
|
,A.WorkPoint,C.InvCode from ICSContainer A |
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint |
|
|
|
INNER JOIN ICSDeliveryNotice E ON E.DNCode=D.TransCode AND E.Sequence=D.TransSequence AND E.WorkPoint=D.WorkPoint |
|
|
@ -3533,14 +3547,14 @@ namespace ICSSoft.DataProject |
|
|
|
UNION ALL |
|
|
|
select E.ApplyNegCode AS TransNO,E.Sequence AS TransLine,C.LotNo,C.Quantity,'生产退料' AS DocType |
|
|
|
,A.WorkPoint,C.InvCode from ICSContainer A |
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ContainerID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLot C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint |
|
|
|
INNER JOIN ICSInventoryLotDetail D ON D.LotNo=C.LotNo AND D.WorkPoint=C.WorkPoint |
|
|
|
INNER JOIN ICSMOApplyNegDetail E ON E.ApplyNegCode=D.TransCode AND E.Sequence=D.TransSequence AND E.WorkPoint=D.WorkPoint |
|
|
|
where A.ContainerCode='{0}'";
|
|
|
|
sql = string.Format(sql, ContainerCode); |
|
|
|
dt = DBHelper.SQlReturnData(sql, cmd); |
|
|
|
if (chkdt.Rows.Count != dt.Rows.Count) |
|
|
|
if (Convert.ToInt32(chkdt.Rows[0]["LotCount"]) != dt.Rows.Count) |
|
|
|
{ |
|
|
|
throw new Exception("料架:" + ContainerCode + ",绑定条码的数量与实际查到的条码单据关联数据不符,请确认条码信息!"); |
|
|
|
} |
|
|
|