Browse Source

新增仓库区域验证

master
lilili 1 year ago
parent
commit
ce377b3144
  1. 218
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  2. 6
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs

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

@ -7673,5 +7673,223 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
}
}
}
#region 库位区域验证
/// <summary>
/// 库位区域验证
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static string CheckWHCode(BarCodeCheckModel JsonData)
{
var language = LanguageHelper.GetName("WMSAPIInfo");
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
try
{
if (string.IsNullOrEmpty(JsonData.TransType))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo002"));//"单据类型不能为空!"
}
else if (!EnumHelper.HasDescriptions(typeof(TransTypeEnum), JsonData.TransType))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo003"));//"单据类型不存在!"
}
else if (string.IsNullOrEmpty(JsonData.WorkPoint))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!"
}
string TransType = JsonData.TransType; //单据类型
var whCode = JsonData.LocationCode.Split('-').ToList();
#region SLQ
StringBuilder sql = new StringBuilder();
#endregion
string msg = "";
//WMSAPIInfo071
if (JsonData.TransCode==null || JsonData.TransCode=="")
{
#region 采购入库
var a = TransTypeEnum.DeliveryNotice.GetDescription();
if (TransType == TransTypeEnum.DeliveryNotice.GetDescription())
{
sql.Append ($@"SELECT a.LotNo ,d.LocationCode, c.WHCode
FROM
ICSInventoryLot a
inner JOIN ICSInventoryLotDetail b ON a.WorkPoint= b.WorkPoint
AND a.LotNo=b.LotNo
inner Join ICSInventoryDetail d ON d.INVCode=a.InvCode
AND d.WorkPoint=b.WorkPoint
inner JOIN ICSDeliveryNotice c ON c.DNCode= b.TransCode
AND c.WorkPoint= b.WorkPoint
AND c.InvCode= a.INVCode
AND c.Sequence= b.TransSequence
AND c.WHCode=d.WHCode
WHERE
b.WorkPoint= '{JsonData.WorkPoint}'
AND a.LotNo= '{JsonData.BarCode}'") ;
}
#endregion
#region 生产退料
if (TransType == TransTypeEnum.MOIssueDocNegative.GetDescription()
|| TransType == TransTypeEnum.MOIssueDocNegativeApply.GetDescription()
|| TransType == TransTypeEnum.MOIssueDocNegativeIssue.GetDescription())
{
sql.Append($@"SELECT a.LotNo ,d.LocationCode, c.WHCode
FROM
ICSInventoryLot a
inner JOIN ICSInventoryLotDetail b ON a.WorkPoint= b.WorkPoint
AND a.LotNo=b.LotNo
inner Join ICSInventoryDetail d ON d.INVCode=a.InvCode
AND d.WorkPoint=b.WorkPoint
inner JOIN ICSMOApplyNegDetail c ON c.ApplyNegCode= b.TransCode
AND c.WorkPoint= b.WorkPoint
AND c.InvCode= a.INVCode
AND c.Sequence= b.TransSequence
AND c.WHCode=d.WHCode
WHERE
b.WorkPoint= '{JsonData.WorkPoint}'
AND a.LotNo= '{JsonData.BarCode}'");
}
#endregion
#region 销售退货
else if (TransType == TransTypeEnum.SalesShipmentDocNegative.GetDescription())
{
sql.Append( $@"SELECT a.LotNo ,d.LocationCode, c.WHCode
FROM
ICSInventoryLot a
inner JOIN ICSInventoryLotDetail b ON a.WorkPoint= b.WorkPoint
AND a.LotNo=b.LotNo
inner Join ICSInventoryDetail d ON d.INVCode=a.InvCode
AND d.WorkPoint=b.WorkPoint
inner JOIN ICSSDN c ON c.SDNCode= b.TransCode
AND c.WorkPoint= b.WorkPoint
AND c.InvCode= a.INVCode
AND c.Sequence= b.TransSequence
AND c.WHCode=d.WHCode
WHERE
b.WorkPoint= '{JsonData.WorkPoint}'
AND a.LotNo= '{JsonData.BarCode}'");
}
#endregion
#region 其他入库
else if (TransType == TransTypeEnum.OtherInDoc.GetDescription())
{
sql.Append ($@"SELECT a.LotNo ,d.LocationCode, c.WHCode
FROM
ICSInventoryLot a
inner JOIN ICSInventoryLotDetail b ON a.WorkPoint= b.WorkPoint
AND a.LotNo=b.LotNo
inner Join ICSInventoryDetail d ON d.INVCode=a.InvCode
AND d.WorkPoint=b.WorkPoint
inner JOIN ICSOtherIn c ON c.InCode= b.TransCode
AND c.WorkPoint= b.WorkPoint
AND c.InvCode= a.INVCode
AND c.Sequence= b.TransSequence
AND c.WHCode=d.WHCode
WHERE
b.WorkPoint= '{JsonData.WorkPoint}'
AND a.LotNo= '{JsonData.BarCode}'");
}
#endregion
}
else
{
#region 销售退货-原条码
if (TransType == TransTypeEnum.SalesReturnBack.GetDescription())
{
sql.Append($@"SELECT a.LotNo ,d.LocationCode, c.WHCode
FROM
ICSInventoryLot a
inner Join ICSInventoryDetail d ON d.INVCode=a.InvCode
inner JOIN ICSSDN c ON c.InvCode= a.INVCode
AND c.WHCode=d.WHCode
AND c.Type='2'
WHERE
c.WorkPoint= '{JsonData.WorkPoint}'
AND a.LotNo= '{JsonData.BarCode}'
And c.SDNCode= '{JsonData.TransCode}' ");
}
#endregion
#region 调拨
else if (TransType == TransTypeEnum.OneStepTransferDocIn.GetDescription())
{
sql.Append ($@"SELECT a.LotNo ,d.LocationCode, c.ToWarehouseCode as WHCode
FROM
ICSInventoryLot a
inner Join ICSInventoryDetail d ON d.INVCode=a.InvCode
inner JOIN ICSTransfer c ON c.INVCode= a.INVCode
AND c.ToWarehouseCode=d.WHCode
WHERE
c.WorkPoint= '{JsonData.WorkPoint}'
AND a.LotNo= '{JsonData.BarCode}'
And c.TransferNO= '{JsonData.TransCode}'");
}
#endregion
}
var dataset=DBHelper.SQlReturnDataSet(sql.ToString(),cmd);
if (dataset.Tables.Count == 0)
{
msg = "未查到条码库位区域信息";
return msg;
}
DataTable table = dataset.Tables[0];
if (table.Rows.Count == 0)
{
msg = "未查到条码库位区域信息";
return msg;
}
for (int i=0;i< table.Rows.Count;i++)
{
//区域
var locationCode = table.Rows[i]["LocationCode"].ToString();
var Code= table.Rows[i]["WHCode"].ToString();
if (Code != whCode[0])
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo466"), Code, "", JsonData.LocationCode));
}
if (locationCode != whCode[1]&& locationCode!=null &&locationCode!="")
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo465"), locationCode, "", JsonData.LocationCode));
}
}
msg = "验证成功";
return msg;
}
catch (Exception ex)
{
log.Error(ex.Message);
throw new Exception(ex.Message);
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Dispose();
}
}
}
#endregion
}
}

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

@ -481,7 +481,11 @@ namespace ICSSoft.WebAPI.Controllers
{
BarCodeCheckModel model = new BarCodeCheckModel();
model = JsonConvert.DeserializeObject<BarCodeCheckModel>(JsonData.ToString());
//var resultStr = ICSSubmitService.TransInformationGet(model);
res.Message = ICSSubmitService.CheckWHCode(model);
if (res.Message=="验证成功")
{
res.Success = true;
}
}
}
catch (Exception ex)

Loading…
Cancel
Save