Browse Source

PDA服务

master
陆晔 2 years ago
parent
commit
8dce5e1d4a
  1. 12
      ICSSoft.WMS.WebAPI/ICSSoft.Common/TransTypeEnum.cs
  2. 300
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
  3. 157
      ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSWareHouseLotInfoService.cs
  4. 126
      ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs

12
ICSSoft.WMS.WebAPI/ICSSoft.Common/TransTypeEnum.cs

@ -213,5 +213,17 @@ namespace ICSSoft.Common
[DBValue("47")]
StepTransferApplicationIn,
[Description("条码查询")]
[DBValue("70")]
LOTInfoGet,
[Description("绑定")]
[DBValue("71")]
ContainerBind,
[Description("解绑")]
[DBValue("72")]
ContainerUnBind,
}
}

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

@ -918,10 +918,10 @@ namespace ICSSoft.DataProject
WHERE {2} ";
#endregion
}
else if(isMerge)//合并发料
else if (isMerge)//合并发料
{
#region SLQ
string sqlMerge = "SELECT ID FROM ICSMOPickMerge WHERE MergeID='"+ JsonData.TransCode + "' AND WorkPoint='"+ JsonData.WorkPoint + "'";
string sqlMerge = "SELECT ID FROM ICSMOPickMerge WHERE MergeID='" + JsonData.TransCode + "' AND WorkPoint='" + JsonData.WorkPoint + "'";
DataTable sign = DBHelper.SQlReturnData(sqlMerge, cmd);
if (sign != null && flag.Rows.Count > 0)
@ -970,6 +970,132 @@ namespace ICSSoft.DataProject
}
#endregion
#region 料架信息
/// <summary>
/// 料架验证
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static Result ContainerCheck(ICSContainerInfo JsonData)
{
var language = LanguageHelper.GetName("WMSAPIInfo");
DataTable table = new DataTable();
string msg = "";
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
try
{
string TransType = JsonData.TransType;
string ContainerID = "";
if (String.IsNullOrEmpty(JsonData.ContainerCode))
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo007"));//"传入数据为空!"
}
if (String.IsNullOrEmpty(JsonData.WorkPoint))
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!"
}
if (TransType != TransTypeEnum.ContainerBind.GetDescription() && TransType != TransTypeEnum.ContainerUnBind.GetDescription())
{
throw new Exception(language.GetNameByCode("WMSAPIInfo199"));//"操作类型错误!"
}
string chksql = @"select ID,ContainerCode from ICSContainer
where ContainerCode='{0}' AND WorkPoint='{1}'";
chksql = string.Format(chksql, JsonData.ContainerCode, JsonData.WorkPoint);
DataTable chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (chkdt.Rows.Count == 0)
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo195"), JsonData.ContainerCode);//"容器不存在!"
}
else
{
ContainerID = chkdt.Rows[0]["ID"].ToString();
}
if (TransType == TransTypeEnum.ContainerBind.GetDescription())
{
chksql = @" select C.LotNo from ICSContainer A
INNER JOIN ICSContainerLot B ON B.ContainerID=A.ID AND B.WorkPoint=A.WorkPoint
INNER JOIN ICSWareHouseLotInfo C ON C.LotNo=B.LotNo AND C.WorkPoint=B.WorkPoint
WHERE A.ContainerCode='{0}' AND A.WorkPoint='{1}'";
chksql = string.Format(chksql, JsonData.ContainerCode, JsonData.WorkPoint);
chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (chkdt.Rows.Count != 0)
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo196"), JsonData.ContainerCode);//"容器已入库!"
}
}
else
{
chksql = @"select LotNo from ICSContainerLot
where ContainerID='{0}' AND WorkPoint='{1}'";
chksql = string.Format(chksql, ContainerID, JsonData.WorkPoint);
chkdt = DBHelper.SQlReturnData(chksql, cmd);
if (chkdt.Rows.Count == 0)
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo200"), JsonData.ContainerCode);//"容器未绑定条码!"
}
else
{
string sql = @"SELECT a.ID,
con.ContainerCode,
con.ContainerName,
a.LotNo,
a.InvCode,
inv.InvName,
inv.InvStd,
a.Quantity
FROM ICSWareHouseLotInfo a
LEFT JOIN ICSContainerLot conlot ON a.LotNo=conlot.LotNo AND a.WorkPoint=conlot.WorkPoint
LEFT JOIN ICSContainer con ON conlot.ContainerID=con.ID AND conlot.WorkPoint=con.WorkPoint
INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint
WHERE bom.ContainerCode='{0}' AND a.WorkPoint='{1}' ";
sql = string.Format(sql, JsonData.ContainerCode, JsonData.WorkPoint);
log.Info("条码sql:" + sql);
table = DBHelper.SQlReturnData(sql, cmd);
}
}
Result res = new Result();
if (msg == "")
{
if (TransType == TransTypeEnum.ContainerBind.GetDescription())
{
res.Success = true;
res.Message = msg;// "接口调用成功!";
}
else
{
res.Success = true;
res.Message = msg;// "接口调用成功!";
res.Data = table;
}
}
else
{
res.Success = false;
res.Message = msg;// "返回错误信息!";
}
return res;
}
catch (Exception ex)
{
log.Error(ex.Message);
throw new Exception(ex.Message);
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Dispose();
}
}
}
#endregion
#region 条码信息
/// <summary>
/// 条码信息
@ -1222,7 +1348,7 @@ namespace ICSSoft.DataProject
|| TransType == TransTypeEnum.OutsourcingReceiveDocNegative.GetDescription()//开立委外红字入库单
|| TransType == TransTypeEnum.BrrowDoc.GetDescription() //借用
|| TransType == TransTypeEnum.TransferLibrary.GetDescription() //移库
//|| TransType == TransTypeEnum.DisassemblyDoc.GetDescription() //拆卸单(散件生成条码入库)
//|| TransType == TransTypeEnum.DisassemblyDoc.GetDescription() //拆卸单(散件生成条码入库)
)
{
isOut = true;
@ -1230,17 +1356,17 @@ namespace ICSSoft.DataProject
//库位查询
if (TransType == TransTypeEnum.LocationSeatch.GetDescription())
{
// Losql = @"" + Losql + "group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit,ext.ID,ext.ProjectCode,ext.Version,ext.Brand, " +
// "ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME";
// Losql = @"" + Losql + "group by a.ID,con.ContainerCode,con.ContainerName,a.LotNo,a.InvCode,inv.InvName,inv.InvStd,inv.InvUnit,inv.LotEnable,s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,s.sumQty,inv.AmountUnit,ext.ID,ext.ProjectCode,ext.Version,ext.Brand, " +
// "ext.cFree1,ext.cFree2,ext.cFree3,ext.cFree4,ext.cFree5,ext.cFree6,ext.cFree7,ext.cFree8,ext.cFree9,ext.cFree10,a.MUSER ,a.MTIME";
// columns = @"s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,sum(a.Quantity) as Qty,s.sumQty,";
// columns = @"s.WarehouseCode, inv.INVCODE,inv.INVNAME,inv.INVSTD,sum(a.Quantity) as Qty,s.sumQty,";
// tableName = @"ICSWareHouseLotInfo a
//LEFT JOIN ICSLocation b ON a.LocationCode = b.LocationCode and a.WorkPoint=b.WorkPoint
//INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint
//INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint
//LEFT JOIN (select SUM(Quantity) AS sumQty,WarehouseCode,INVCode from ICSWareHouseLotInfo group by WarehouseCode,INVCode)s
//ON a.INVCode=s.INVCode ";
// tableName = @"ICSWareHouseLotInfo a
//LEFT JOIN ICSLocation b ON a.LocationCode = b.LocationCode and a.WorkPoint=b.WorkPoint
//INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint
//INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint
//LEFT JOIN (select SUM(Quantity) AS sumQty,WarehouseCode,INVCode from ICSWareHouseLotInfo group by WarehouseCode,INVCode)s
//ON a.INVCode=s.INVCode ";
}
else
@ -1694,6 +1820,25 @@ namespace ICSSoft.DataProject
LEFT JOIN (SELECT EATTRIBUTE1 AS LotNo,WorkPoint,EATTRIBUTE1+'-'+CAST((MAX(CAST(SUBSTRING(LotNo, CHARINDEX('-', LotNo)+1, LEN(LotNo)-CHARINDEX('-', LotNo)) AS INT))+1) AS VARCHAR) AS SplitLotNo FROM ICSInventoryLot GROUP BY EATTRIBUTE1,WorkPoint) split ON a.LotNo=split.LotNo AND a.WorkPoint=split.WorkPoint
LEFT JOIN ICSInventoryBatchEnable invBat ON a.InvCode=invBat.InvCode AND a.WarehouseCode=invBat.WHCode AND a.WorkPoint=invBat.WorkPoint";
}
else if (TransType == TransTypeEnum.LOTInfoGet.GetDescription())
{
sql = @"IF EXISTS(SELECT a.ID FROM ICSWareHouseLotInfo a WHERE a.LotNo='{2}' AND a.WorkPoint='{3}' AND a.Quantity>0)
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo039"), "{2}") + @"',16,1);
RETURN
END
IF NOT EXISTS(SELECT a.ID FROM ICSInventoryLot a WHERE a.LotNo='{2}' AND a.WorkPoint='{3}' )
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo038"), "{2}") + @"',16,1);
RETURN
END
" + sql;
columns = @"a.Quantity,";
tableName = @" ICSInventoryLot a
INNER JOIN ICSExtension ext ON ext.ID=a.ExtensionID AND ext.WorkPoint=a.WorkPoint";
}
//出库条码
else if (isOut)
{
@ -1820,7 +1965,7 @@ namespace ICSSoft.DataProject
if (mode.itemCode.Equals("LocationRemind01"))
{
{
columnsWHNAME = @"
(SELECT Top 1 locat.LocationName from ICSWareHouseLotInfoLog log
LEFT JOIN ICSLocation locat on locat.LocationCode=log.ToLocationCode and log.WorkPoint=locat.WorkPoint where log.TransType='2' and a.InvCode=log.InvCode AND a.WorkPoint=log.WorkPoint
@ -1828,9 +1973,9 @@ namespace ICSSoft.DataProject
}
else if (mode.itemCode.Equals("LocationRemind02"))
{
}
else if (mode.itemCode.Equals("LocationRemind02"))
{
columnsWHNAME = @"
STUFF(
(SELECT DISTINCT ',' + LocationName
@ -1842,10 +1987,10 @@ namespace ICSSoft.DataProject
) AS LocationName,";
}
else
{
columnsWHNAME = @"
}
else
{
columnsWHNAME = @"
STUFF(
(SELECT DISTINCT ',' + LocationName
from ICSLocation wh
@ -1855,18 +2000,20 @@ namespace ICSSoft.DataProject
),1,1,''
) AS LocationName,";
}
}
#region 根据条码类型找到单据仓库信息
if (LotType.Equals("1"))
{//生产退料
columnsWHCODE = @"(SELECT negg.WHCODE FROM ICSMOApplyNegDetail neg LEFT JOIN ICSMOApplyNeg negg ON neg.ApplyNegCode=negg.ApplyNegCode
WHERE lotdd.TransCode=neg.ApplyNegCode AND lotdd.TransSequence=neg.Sequence AND lotdd.WorkPoint=neg.WorkPoint and negg.Type='1') AS WHCode";
}else if (LotType.Equals("2"))
}
else if (LotType.Equals("2"))
{//委外退料
columnsWHCODE = @"(SELECT negg.WHCODE FROM ICSOApplyNegDetail neg LEFT JOIN ICSOApplyNeg negg ON neg.OApplyNegCode=negg.OApplyNegCode
WHERE lotdd.TransCode=neg.OApplyNegCode AND lotdd.TransSequence=neg.Sequence AND lotdd.WorkPoint=neg.WorkPoint and negg.Type='1') AS WHCode";
}else if (LotType.Equals("3"))
}
else if (LotType.Equals("3"))
{//工单
columnsWHCODE = @"(SELECT a.WHCode FROM ICSMO a WHERE a.MOCode=lotdd.TransCode AND a.Sequence=lotdd.TransSequence AND a.WorkPoint=lotdd.WorkPoint) AS WHCode";
}
@ -2005,7 +2152,7 @@ namespace ICSSoft.DataProject
{
Losql = string.Format(Losql, columns, tableName, JsonData.Code, JsonData.WorkPoint);
table = DBHelper.SQlReturnData(Losql, cmd);
table = DBHelper.SQlReturnData(Losql, cmd);
}
else
{
@ -2046,7 +2193,7 @@ namespace ICSSoft.DataProject
}
}
else if(TransType != TransTypeEnum.LocationSeatch.GetDescription())
else if (TransType != TransTypeEnum.LocationSeatch.GetDescription())
{
if (string.IsNullOrEmpty(JsonData.TransCode))
{
@ -2378,7 +2525,7 @@ namespace ICSSoft.DataProject
}
//入库
ICSWareHouseLotInfoService.WareHouseLotInfoUp(Identification, itemInfo.LocationCode, itemInfo.LotNo, itemInfo.Quantity,
item.User, item.WorkPoint, WHTransType, BusinessCode, cmd, language,itemInfo.LogID,itemInfo.InvCode + itemInfo.WarehouseCode);
item.User, item.WorkPoint, WHTransType, BusinessCode, cmd, language, itemInfo.LogID, itemInfo.InvCode + itemInfo.WarehouseCode);
}
}
@ -2423,7 +2570,7 @@ namespace ICSSoft.DataProject
ICSManufactureService.MOIssueDocNegativeERP(TransType, Identification, cmd, language, BusinessCode);
//生产入库
else if (TransType == TransTypeEnum.ManufactureReceiveDoc.GetDescription())
ICSManufactureService.ManufactureReceiveDocERP(TransType, Identification, cmd, language,BusinessCode);
ICSManufactureService.ManufactureReceiveDocERP(TransType, Identification, cmd, language, BusinessCode);
//开立的生产入库单
else if (TransType == TransTypeEnum.ManufactureReceive.GetDescription())
ICSManufactureService.ManufactureReceiveERP(TransType, Identification, cmd, language, BusinessCode);
@ -2525,7 +2672,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription<DBValue>(), cmd, language);
}
}
@ -2540,7 +2687,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OutsourcingIssueDoc.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
@ -2570,7 +2717,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.MOIssueDoc.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
@ -2615,7 +2762,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OtherOutDoc.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
@ -2646,7 +2793,7 @@ namespace ICSSoft.DataProject
{
//出库
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OOApply.GetDescription<DBValue>(), cmd, language,MergeID);
item.User, item.WorkPoint, "3", TransTypeEnum.OOApply.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
#endregion
@ -2660,7 +2807,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.MOIssue.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
@ -2675,7 +2822,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OOIssue.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
@ -2690,7 +2837,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.PurchaseReceive.GetDescription<DBValue>(), cmd, language);
}
}
@ -2705,7 +2852,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.OutsourcingReceiveDocNegative.GetDescription<DBValue>(), cmd, language);
}
}
@ -2720,7 +2867,7 @@ namespace ICSSoft.DataProject
foreach (var itemInfo in item.detail)
{
//出库
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoDown(Identification, item.TransCode, item.TransSequence, itemInfo.LotNo, itemInfo.CurrentQuantity,
item.User, item.WorkPoint, "3", TransTypeEnum.BrrowDoc.GetDescription<DBValue>(), cmd, language, MergeID);
}
@ -2736,7 +2883,7 @@ namespace ICSSoft.DataProject
{
//采购退货
if (TransType == TransTypeEnum.PurchaseReceiveDoctNegative.GetDescription())
ICSPurchaseService.PurchaseReceiveDoctNegativeERP(TransType, Identification, cmd, language,BusinessCode);
ICSPurchaseService.PurchaseReceiveDoctNegativeERP(TransType, Identification, cmd, language, BusinessCode);
//委外发料
else if (TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
ICSOutsourcingService.OutsourcingIssueDocERP(TransType, Identification, cmd, language, BusinessCode);
@ -4734,7 +4881,7 @@ namespace ICSSoft.DataProject
ICSWareHouseService.OneStepTransferDocIn(item.TransCode, item.TransSequence, item.WorkPoint, itemInfo.CurrentQuantity, cmd, language);
//更新条码信息
printTable=ICSWareHouseLotInfoService.WareHouseLotInfoTransfer(Identification, item.TransCode, item.TransSequence, itemInfo.WarehouseCode, itemInfo.LocationCode,
printTable = ICSWareHouseLotInfoService.WareHouseLotInfoTransfer(Identification, item.TransCode, item.TransSequence, itemInfo.WarehouseCode, itemInfo.LocationCode,
itemInfo.LotNo, itemInfo.CurrentQuantity, item.User, item.WorkPoint, "6", TransTypeEnum.OneStepTransferDocIn.GetDescription<DBValue>(), cmd, language, MergeID);
}
}
@ -5585,7 +5732,7 @@ namespace ICSSoft.DataProject
sql = @"SELECT a.ContainerCode, a.ContainerName,b.LotNo FROM ICSContainer a
INNER JOIN ICSContainerLot b ON a.ID=b.ContainerID
WHERE a.ContainerCODE+a.WorkPoint IN({0})";
sql = string.Format(sql, codes.Substring(0,codes.Length - 1));
sql = string.Format(sql, codes.Substring(0, codes.Length - 1));
DataTable table = DBHelper.SQlReturnData(sql, cmd);
cmd.Transaction.Commit();
return table;
@ -6185,6 +6332,79 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
}
#endregion
#region 料架条码绑定/解绑
/// <summary>
/// 料架条码绑定
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
public static Result ContainerBindCreate(List<ICSContainerBind> JsonData)
{
var language = LanguageHelper.GetName("WMSAPIInfo");
DataTable table = new DataTable();
string msg = "";
using (SqlConnection conn = new System.Data.SqlClient.SqlConnection(connString))
{
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
try
{
foreach (ICSContainerBind item in JsonData)
{
string TransType = item.TransType;
if (JsonData.Count <= 0)
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo007"));//"传入数据为空!"
}
if (String.IsNullOrEmpty(item.WorkPoint))
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!"
}
if (String.IsNullOrEmpty(item.LotNo))
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo005"));//"条码不能为空!"
}
if (String.IsNullOrEmpty(item.ContainerCode))
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo197"));//"料架不能为空!"
}
if (TransType != TransTypeEnum.ContainerBind.GetDescription() && TransType != TransTypeEnum.ContainerUnBind.GetDescription())
{
msg = string.Format(language.GetNameByCode("WMSAPIInfo199"));//"操作类型错误!"
}
if (TransType == TransTypeEnum.ContainerBind.GetDescription())
{
//料架条码绑定
ICSWareHouseLotInfoService.ContainerBind(item.LotNo, item.ContainerCode, item.ContainerType, item.User, item.WorkPoint, cmd, language);
}
else
{
//料架条码解绑
ICSWareHouseLotInfoService.ContainerUnBind(item.ContainerCode, item.WorkPoint, cmd, language);
}
}
Result res = new Result();
res.Success = true;
res.Message = msg;// "接口调用成功!";
return res;
}
catch (Exception ex)
{
log.Error(ex.Message);
throw new Exception(ex.Message);
}
finally
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
conn.Dispose();
}
}
}
#endregion
}
}

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

@ -52,7 +52,7 @@ namespace ICSSoft.DataProject
/// <param name="cmd"></param>
/// <param name="jointLotNo"></param>
public static void WareHouseLotInfoUp(string Identification, string LocationCode, string LotNo, string Quantity, string User,
string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary<string, string> language, string LogID,string jointLotNo)
string WorkPoint, string TransType, string BusinessCode, SqlCommand cmd, Dictionary<string, string> language, string LogID, string jointLotNo)
{
try
{
@ -228,25 +228,25 @@ namespace ICSSoft.DataProject
lotNoMode.Version, lotNoMode.Brand, lotNoMode.cFree1, lotNoMode.cFree2, lotNoMode.cFree3, lotNoMode.cFree4, lotNoMode.cFree5, lotNoMode.cFree6, lotNoMode.cFree7,
lotNoMode.cFree8, lotNoMode.cFree9, lotNoMode.cFree10, cmd, language, LocationCode, LotNo);
}
try
{
try
{
//合并前日志
WareHouseLotInfoLog(Identification, jointLotNo, User, WorkPoint, "2",
TransTypeEnum.LOTMergeBefore.GetDescription<DBValue>(), cmd, language);
//合并前日志
WareHouseLotInfoLog(Identification, jointLotNo, User, WorkPoint, "2",
TransTypeEnum.LOTMergeBefore.GetDescription<DBValue>(), cmd, language);
//更新目标条码库存
WareHouseLotInfoMerge(Identification, jointLotNo, LotNo, Quantity, User, WorkPoint, "2",
TransTypeEnum.LOTMergeAfter.GetDescription<DBValue>(), cmd, language);
//更新目标条码库存
WareHouseLotInfoMerge(Identification, jointLotNo, LotNo, Quantity, User, WorkPoint, "2",
TransTypeEnum.LOTMergeAfter.GetDescription<DBValue>(), cmd, language);
//合并后日志
WareHouseLotInfoLog(Identification, jointLotNo, User, WorkPoint, "2",
TransTypeEnum.LOTMergeAfter.GetDescription<DBValue>(), cmd, language);
}
catch (Exception)
{
throw;
}
//合并后日志
WareHouseLotInfoLog(Identification, jointLotNo, User, WorkPoint, "2",
TransTypeEnum.LOTMergeAfter.GetDescription<DBValue>(), cmd, language);
}
catch (Exception)
{
throw;
}
}
@ -386,8 +386,8 @@ namespace ICSSoft.DataProject
DROP table #resulttemp
DROP table #barcodetemp";
#endregion
sql = String.Format(sql,LotNo,WorkPoint, Quantity);
DataTable table = DBHelper.SQlReturnData(sql,cmd);
sql = String.Format(sql, LotNo, WorkPoint, Quantity);
DataTable table = DBHelper.SQlReturnData(sql, cmd);
string json = JsonConvert.SerializeObject(table);
List<DownItemModel> downItemModels = JsonConvert.DeserializeObject<List<DownItemModel>>(json);
foreach (DownItemModel model in downItemModels)
@ -396,10 +396,10 @@ namespace ICSSoft.DataProject
{
throw new Exception(language.GetNameByCode("WMSAPIInfo201"));
}
WareHouseLotInfoDown(Identification,model.TransCode,model.Sequence + "~" + model.TransSequence,model.LotNo,model.Quantity,User,WorkPoint,"12",BusinessCode,cmd,language);
WareHouseLotInfoDown(Identification, model.TransCode, model.Sequence + "~" + model.TransSequence, model.LotNo, model.Quantity, User, WorkPoint, "12", BusinessCode, cmd, language);
//回写已领数量
sql = @"UPDATE ICSMOPick SET IssueQuantity=(ISNULL(IssueQuantity,0)+" + model.Quantity+") WHERE MODetailID='{0}' AND Sequence='{1}' AND WorkPoint='{2}'";
sql = String.Format(sql,model.DetailID,model.TransSequence,WorkPoint);
sql = @"UPDATE ICSMOPick SET IssueQuantity=(ISNULL(IssueQuantity,0)+" + model.Quantity + ") WHERE MODetailID='{0}' AND Sequence='{1}' AND WorkPoint='{2}'";
sql = String.Format(sql, model.DetailID, model.TransSequence, WorkPoint);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo199"));
@ -553,7 +553,7 @@ namespace ICSSoft.DataProject
}
WareHouseLotInfoDown(Identification, model.TransCode, model.Sequence + "~" + model.TransSequence, model.LotNo, model.Quantity, User, WorkPoint, "13", BusinessCode, cmd, language);
//回写已领数量
sql = @"UPDATE ICSOOPick SET IssueQuantity=(ISNULL(IssueQuantity,0)+" + model.Quantity+") WHERE OODetailID='{0}' AND Sequence='{1}' AND WorkPoint='{2}'";
sql = @"UPDATE ICSOOPick SET IssueQuantity=(ISNULL(IssueQuantity,0)+" + model.Quantity + ") WHERE OODetailID='{0}' AND Sequence='{1}' AND WorkPoint='{2}'";
sql = String.Format(sql, model.DetailID, model.TransSequence, WorkPoint);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
@ -634,7 +634,7 @@ namespace ICSSoft.DataProject
if (LotEnable.Equals("True"))
{
///分批前添加日志
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{2}") + @"',16,1);
RETURN
@ -755,7 +755,7 @@ namespace ICSSoft.DataProject
";
sql = string.Format(sql, LotNo, WorkPoint);
dtLotno = DBHelper.SQlReturnData(sql, cmd);
lstDt=dtLotno;
lstDt = dtLotno;
}
///添加日志
@ -846,7 +846,7 @@ namespace ICSSoft.DataProject
/// <param name="TransType"></param>
/// <param name="cmd"></param>
public static void WareHouseLotInfoUpdate(string Identification, string TransCode, string TransSequence, string LotNo, string Quantity, string User,
string WorkPoint, string TransType,string CheckKind, SqlCommand cmd, Dictionary<string, string> language)
string WorkPoint, string TransType, string CheckKind, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
@ -1201,7 +1201,7 @@ namespace ICSSoft.DataProject
{
string sql = @"SELECT WarehouseCode FROM ICSWareHouseLotInfo a WHERE LotNo='{0}' AND WorkPoint='{1}'";
sql = string.Format(sql, LotNo,WorkPoint);
sql = string.Format(sql, LotNo, WorkPoint);
DataTable dt = DBHelper.SQlReturnData(sql, cmd);
if (dt == null || dt.Rows.Count <= 0)
{
@ -1209,7 +1209,7 @@ namespace ICSSoft.DataProject
}
string whcode = dt.Rows[0]["WarehouseCode"].ToString();
///添加日志
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{2}' AND F_Location='{1}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{2}") + @"',16,1);
RETURN
@ -2200,7 +2200,7 @@ namespace ICSSoft.DataProject
/// <param name="cmd"></param>
/// <param name="language"></param>
public static void CreateLotNo(string LotNo, string Quantity, string TransCode, string TransSequence, string WorkPoint, string Identification, string User, string InvCode, string BusinessCode,
string ProjectCode, string BatchCode, string Version, string Brand, string cFree1, string cFree2, string cFree3, string cFree4, string cFree5,string cFree6, string cFree7, string cFree8, string cFree9, string cFree10, SqlCommand cmd, Dictionary<string, string> language,string LocationCode,string OLDLotNo)
string ProjectCode, string BatchCode, string Version, string Brand, string cFree1, string cFree2, string cFree3, string cFree4, string cFree5, string cFree6, string cFree7, string cFree8, string cFree9, string cFree10, SqlCommand cmd, Dictionary<string, string> language, string LocationCode, string OLDLotNo)
{
try
{
@ -2231,25 +2231,25 @@ namespace ICSSoft.DataProject
//if (!EffectiveEnable.Equals("False"))
//{
int year = now.Year;
int month = now.Month;
int day = now.Day;
int n = DateTime.DaysInMonth(year, month);
int k = day + EffectiveDays;
if (k > n)
{
day = EffectiveDays - (n - day);
month = month + 1;
if (month > 12)
{
month = 1;
year = year + 1;
}
}
else
int month = now.Month;
int day = now.Day;
int n = DateTime.DaysInMonth(year, month);
int k = day + EffectiveDays;
if (k > n)
{
day = EffectiveDays - (n - day);
month = month + 1;
if (month > 12)
{
day = day + EffectiveDays;
month = 1;
year = year + 1;
}
Time = year + "-" + month + "-" + day;
}
else
{
day = day + EffectiveDays;
}
Time = year + "-" + month + "-" + day;
//}
//else
//{
@ -2300,7 +2300,7 @@ namespace ICSSoft.DataProject
FROM Sys_SRM_User f
where f.F_Account='{2}' and f.F_Location='{4}'
";
sql = string.Format(sql, LotNo, Quantity, User, TransCode, WorkPoint, TransSequence, dtt, IDD,InvCode);
sql = string.Format(sql, LotNo, Quantity, User, TransCode, WorkPoint, TransSequence, dtt, IDD, InvCode);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(language.GetNameByCode("WMSAPIInfo366"));
@ -2352,5 +2352,68 @@ namespace ICSSoft.DataProject
throw;
}
}
/// <summary>
/// 料架条码绑定
/// </summary>
/// <param name="LotNo"></param>
/// <param name="ContainerCode"></param>
/// <param name="User"></param>
/// <param name="WorkPoint"></param>
/// <param name="cmd"></param>
/// <param name="language"></param>
public static void ContainerBind(string LotNo, string ContainerCode, string ContainerType, string User, string WorkPoint, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
///添加日志
string sql = @"IF NOT EXISTS(SELECT F_Account FROM Sys_SRM_User WHERE F_Account='{3}' AND F_Location='{2}')
BEGIN
RAISERROR('" + string.Format(language.GetNameByCode("WMSAPIInfo060"), "{3}") + @"',16,1);
RETURN
END
INSERT INTO ICSContainerLot
(ID,ContainerID,LotNo,MUSER,MUSERName,WorkPoint,MTIME,EATTRIBUTE1)
SELECT NEWID(),ID,'{0}','{3}'
,(SELECT F_RealName FROM Sys_SRM_User WHERE F_Account='{3}' AND F_Location='{2}'),'{2}',GETDATE(),'{4}' FROM ICSContainer
WHERE ContainerCode='{1}' AND WorkPoint='{2}'
";
sql = string.Format(sql, LotNo, ContainerCode, WorkPoint, User, ContainerType);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo060"), ContainerCode, LotNo));
}
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// 料架条码解绑
/// </summary>
/// <param name="ContainerCode"></param>
/// <param name="WorkPoint"></param>
/// <param name="cmd"></param>
/// <param name="language"></param>
public static void ContainerUnBind(string ContainerCode, string WorkPoint, SqlCommand cmd, Dictionary<string, string> language)
{
try
{
///添加日志
string sql = @"delete from ICSContainerLot
WHERE ContainerCode='{0}' AND WorkPoint='{1}'";
sql = string.Format(sql, ContainerCode, WorkPoint);
if (!DBHelper.ExecuteNonQuery(sql, cmd))
{
throw new Exception(string.Format(language.GetNameByCode("WMSAPIInfo201"), ContainerCode, ContainerCode));
}
}
catch (Exception)
{
throw;
}
}
}
}

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

@ -258,7 +258,43 @@ namespace ICSSoft.WebAPI.Controllers
return result;
}
/// <summary>
/// 验证箱号是否可用
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[HttpPost]
[Route("api/ContainerCheck/Get")]
public HttpResponseMessage ContainerCheck([FromBody] object JsonData)
{
log.Info("获取条码信息传入值" + JsonData);
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
ICSContainerInfo model = new ICSContainerInfo();
model = JsonConvert.DeserializeObject<ICSContainerInfo>(JsonData.ToString());
//var resultStr = ICSSubmitService.BarCodeInformationGet(model);
//res.Success = true;
//res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
//res.Data = resultStr;
res = ICSSubmitService.ContainerCheck(model);
}
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("获取条码信息返回值:" + str);
return result;
}
/// <summary>
/// 使用中
/// 获取条码信息
@ -1903,7 +1939,7 @@ namespace ICSSoft.WebAPI.Controllers
model = JsonConvert.DeserializeObject<List<TransferApplication>>(JsonData.ToString());
//WMSBarCoreService action = new WMSBarCoreService();
//var resultStr = action.TransferDocupdte(model);
// var resultStr = ICSSubmitService.TransferDocCreate(model);
// var resultStr = ICSSubmitService.TransferDocCreate(model);
var resultStr = ICSSubmitService.TransferApplicationCreate(model);
res.Success = true;
res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
@ -1942,7 +1978,7 @@ namespace ICSSoft.WebAPI.Controllers
model = JsonConvert.DeserializeObject<List<TransferApplication>>(JsonData.ToString());
//WMSBarCoreService action = new WMSBarCoreService();
//var resultStr = action.TransferDocupdte(model);
// var resultStr = ICSSubmitService.TransferDocInCreate(model);
// var resultStr = ICSSubmitService.TransferDocInCreate(model);
var resultStr = ICSSubmitService.TransferApplicationInCreate(model);
res.Success = true;
res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
@ -2062,5 +2098,89 @@ namespace ICSSoft.WebAPI.Controllers
}
#endregion
#region 条码容器绑定
/// <summary>
/// 条码容器绑定
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[HttpPost]
[Route("api/ContainerBind/Create")]
public HttpResponseMessage ContainerBindCreate([FromBody] object JsonData)
{
log.Info("合并传入值" + JsonData);
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
List<ICSContainerBind> model = new List<ICSContainerBind>();
model = JsonConvert.DeserializeObject<List<ICSContainerBind>>(JsonData.ToString());
//WMSBarCoreService action = new WMSBarCoreService();
//var resultStr = action.LOTMergeCreate(model);
//res.Success = true;
//res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
////res.Data = resultStr;
res = ICSSubmitService.ContainerBindCreate(model);
}
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("条码料架绑定返回值:" + str);
return result;
}
#endregion
#region 条码容器绑定
/// <summary>
/// 条码容器绑定
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
[HttpPost]
[Route("api/ContainerUnBind/Create")]
public HttpResponseMessage ContainerUnBindCreate([FromBody] object JsonData)
{
log.Info("合并传入值" + JsonData);
try
{
if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
{
List<ICSContainerBind> model = new List<ICSContainerBind>();
model = JsonConvert.DeserializeObject<List<ICSContainerBind>>(JsonData.ToString());
//WMSBarCoreService action = new WMSBarCoreService();
//var resultStr = action.LOTMergeCreate(model);
//res.Success = true;
//res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
////res.Data = resultStr;
res = ICSSubmitService.ContainerBindCreate(model);
}
}
catch (Exception ex)
{
log.Error("转换失败:" + ex.ToString());
res.Success = false;
res.Message = ex.Message;
}
finally
{
str = JsonConvert.SerializeObject(res);
result.Content = new StringContent(str, Encoding.GetEncoding("UTF-8"), "application/json");
}
log.Debug("条码料架绑定返回值:" + str);
return result;
}
#endregion
}
}
Loading…
Cancel
Save