diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs
index 9a5bd59..04e7b72 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSalesService.cs
@@ -379,11 +379,11 @@ namespace ICSSoft.DataProject
RAISERROR('" + language.GetNameByCode("WMSAPIInfo081") + @"',16,1);
RETURN
END
- ELSE IF (@Status!='2')
- BEGIN
- RAISERROR('" + language.GetNameByCode("WMSAPIInfo142") + @"',16,1);
- RETURN
- END
+ --ELSE IF (@Status!='2')
+ --BEGIN
+ --RAISERROR('" + language.GetNameByCode("WMSAPIInfo142") + @"',16,1);
+ --RETURN
+ --END
UPDATE sdn SET SDNQuantity=ISNULL(SDNQuantity,0)+'{4}'
FROM ICSSDN sdn
INNER JOIN ICSWareHouseLotInfoLog log ON sdn.WorkPoint=log.WorkPoint
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
index 70fabee..dfc4243 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs
@@ -7307,6 +7307,243 @@ WHERE WorkPoint='{0}' AND Quantity>ISNULL(TransferQuantity, 0) order by Transfer
}
#endregion
+ #region 拣料信息
+ ///
+ /// 获取拣料信息
+ ///
+ ///
+ ///
+ public static DataTable GetICSMOPickMergeTemp(WMSSourceDocumentModel 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.TransCode))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo001"));//"单据号不能为空!"
+ }
+ else if (string.IsNullOrEmpty(JsonData.WorkPoint))
+ {
+ throw new Exception(language.GetNameByCode("WMSAPIInfo004"));//"站点不能为空!"
+ }
+ string information = String.Format(language.GetNameByCode("WMSAPIInfo035"), "", "", "", JsonData.TransCode);
+ #region SLQ
+ string sqls = "";
+ #region 工单领料
+ if (JsonData.TransType == TransTypeEnum.MOApply.GetDescription())
+ {
+ #region 工单领料SQL
+ sqls = @" select
+ x.MergeID,
+ a.ApplyCode as Code,
+ a.InvCode,
+ b.InvName,
+ b.InvStd,
+ b.InvUnit,
+ SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ a.WhCode,
+ a.ExtensionID
+ FROM
+ ICSMOApply a
+ inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}'
+ GROUP BY a.ApplyCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,x.MergeID,a.ExtensionID";
+ #endregion
+ }
+ #endregion
+
+ #region 委外领料
+ if (JsonData.TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
+ {
+ #region 委外领料SQL
+ sqls = @" select
+ x.MergeID,
+ a.ApplyCode as Code,
+ a.InvCode,
+ b.InvName,
+ b.InvStd,
+ b.InvUnit,
+ SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ a.WhCode,
+ a.ExtensionID
+ FROM
+ ICSOApply a
+ inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}'
+ GROUP BY a.ApplyCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
+ #endregion
+ }
+ #endregion
+
+ #region 销售发货
+ if (JsonData.TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
+ {
+ #region 销售发货SQL
+ sqls = @" select
+ x.MergeID,
+ a.SDNCode as Code,
+ a.InvCode,
+ b.InvName,
+ b.InvStd,
+ b.InvUnit,
+ SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ a.WhCode,
+ a.ExtensionID
+ FROM
+ ICSSDN a
+ inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ WHERE a.SDNCode in ({0}) AND a.WorkPoint = '{1}'
+ GROUP BY a.SDNCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
+ #endregion
+ }
+ #endregion
+
+ #region 其他出库
+ if (JsonData.TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
+ {
+ #region 其它出库SQL
+ sqls = @" select
+ x.MergeID,
+ a.OutCode as Code,
+ a.InvCode,
+ b.InvName,
+ b.InvStd,
+ b.InvUnit,
+ SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ a.WhCode,
+ a.ExtensionID
+ FROM
+ ICSOtherOut a
+ inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ WHERE a.OutCode in ({0}) AND a.WorkPoint = '{1}'
+ GROUP BY a.OutCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
+ #endregion
+ }
+ #endregion
+
+ #region 物料调拨
+ if (JsonData.TransType == TransTypeEnum.OutsourcingIssueDoc.GetDescription())
+ {
+ #region 物料调拨
+ sqls = @" select
+ x.MergeID,
+ a.TransferNO as Code,
+ a.InvCode,
+ b.InvName,
+ b.InvStd,
+ b.InvUnit,
+ SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ a.FromWarehouseCode as WhCode,
+ a.ExtensionID
+ FROM
+ ICSTransfer a
+ inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ WHERE a.TransferNO in ({0}) AND a.WorkPoint = '{1}'
+ GROUP BY a.TransferNO,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.FromWarehouseCode,a.ExtensionID,x.MergeID";
+ #endregion
+ }
+ #endregion
+
+ sqls = string.Format(sqls, JsonData.TransCode, JsonData.WorkPoint);
+ #region sql
+ string sql = $@"SELECT row_number() over (order by c.Code,c.InvCode,d.MTIME,d.LotNO) AS rowNo,
+ c.MergeID,
+ c.Code,
+ c.InvCode,
+ c.InvName,
+ c.InvStd,
+ c.InvUnit,
+ FLOOR(c.iQuantity) AS iQuantity,
+ d.WarehouseCode,
+ d.LocationCode,
+ d.LotNO,
+ FLOOR(ISNULL(d.Quantity, 0)) AS QTY,
+ CONVERT(varchar(100),d.MTIME, 23) MTIME,
+ FLOOR(f.QTYTotal) QTYTotal
+ FROM
+ ({sqls}) c
+ left join (select d.WarehouseCode,d.Quantity,d.INVCode, m.LotNo, d.MTIME,d.LocationCode,m.ExtensionID
+ from ICSWareHouseLotInfo d ,ICSInventoryLot m
+ where d.LotNo=m.LotNo and d.WorkPoint=m.WorkPoint
+ and d.WorkPoint='{JsonData.WorkPoint}' AND d.Quantity>0 ) d
+ on c.InvCode=d.INVCode AND c.WhCode=d.WarehouseCode and d.ExtensionID=c.ExtensionID
+ LEFT JOIN (SELECT INVCode,WarehouseCode,SUM(Quantity) AS QTYTotal FROM ICSWareHouseLotInfo WHERE WorkPoint='{JsonData.WorkPoint}' GROUP BY INVCode,WarehouseCode) f ON c.InvCode=f.INVCode AND c.WhCode=f.WarehouseCode
+ order by c.Code,c.InvCode,d.MTIME ";
+ #endregion
+ var dataset = DBHelper.SQlReturnDataSet(sql, cmd); ;
+ if (dataset.Tables.Count == 0)
+ return null;
+ DataTable table = dataset.Tables[0];
+ decimal qtyCount = 0;
+ bool remove = false;
+ List removeList = new List();
+ for (int i = 0; i < table.Rows.Count; i++)
+ {
+
+ if (i != 0
+ && (!table.Rows[i]["InvCode"].ToString().Equals(table.Rows[i - 1]["InvCode"].ToString())
+ || !table.Rows[i]["Code"].ToString().Equals(table.Rows[i - 1]["Code"].ToString()))
+ )
+ {
+ qtyCount = 0;
+ remove = false;
+ }
+ if (remove)
+ {
+ removeList.Add(i);
+ }
+ else
+ {
+ var lotQty =decimal.Parse(table.Rows[i]["QTY"].ToString());
+ var orderQty =decimal.Parse( table.Rows[i]["iQuantity"].ToString());
+ qtyCount += lotQty;
+ if (qtyCount >= orderQty)
+ {
+ remove = true;
+ }
+ }
+ }
+ if (removeList.Count > 0)
+ {
+ removeList.Reverse();
+ foreach (var item in removeList)
+ {
+ table.Rows.RemoveAt(item);
+ }
+ }
+
+ #endregion
+
+ //DataTable table = DBHelper.SQlReturnData(sql, cmd);
+ return table;
+ }
+ catch (Exception ex)
+ {
+ log.Error(ex.Message);
+ throw new Exception(ex.Message);
+ }
+ finally
+ {
+ if (conn.State == ConnectionState.Open)
+ {
+ conn.Close();
+ }
+ conn.Dispose();
+ }
+ }
+ }
+ #endregion
+
///
/// 形态转换
///
diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
index 8a8811a..deff360 100644
--- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
+++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs
@@ -304,6 +304,237 @@ namespace ICSSoft.WebAPI.Controllers
log.Debug("获取源头单据信息返回值:" + str);
return result;
+ }
+
+ ///
+ /// 获取拣料信息
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("api/GetICSMOPickMergeTemp/Get")]
+ public HttpResponseMessage GetICSMOPickMergeTemp([FromBody] object JsonData)
+ {
+ log.Info("获取源头单据信息传入值" + JsonData);
+ try
+ {
+ if (JsonData != null && !string.IsNullOrWhiteSpace(JsonData.ToString()) && JsonData.ToString() != "[]")
+ {
+ WMSSourceDocumentModel model = new WMSSourceDocumentModel();
+ model = JsonConvert.DeserializeObject(JsonData.ToString());
+ var resultStr = ICSSubmitService.GetICSMOPickMergeTemp(model);
+
+ if (resultStr != null && resultStr.Rows.Count > 0 && resultStr.ToString() != "[]")
+ {
+ res.Success = true;
+ res.Message = LanguageHelper.GetNameSingle("WMSAPI001");// LanguageHelper.GetNameSingle("WMSAPI001");// "接口调用成功!";
+ res.Data = resultStr;
+ }
+ else
+ {
+ res.Success = false;
+ res.Message = LanguageHelper.GetNameSingle("WMSAPI003");//"未查询到相关数据!";
+ //res.Data = resultStr;
+ }
+ // string sqls = "";
+ // if (Type == "2")
+ // {
+ // #region 工单领料SQL
+ // sqls = @" select
+ // x.MergeID,
+ // a.ApplyCode as Code,
+ // a.InvCode,
+ // b.InvName,
+ // b.InvStd,
+ // b.InvUnit,
+ // SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ // a.WhCode,
+ // a.ExtensionID
+ // FROM
+ // ICSMOApply a
+ //inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ // LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ // WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}'
+ // GROUP BY a.ApplyCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,x.MergeID,a.ExtensionID";
+ // #endregion
+ // }
+
+ // if (Type == "5")
+ // {
+ // #region 委外领料SQL
+ // sqls = @" select
+ // x.MergeID,
+ // a.ApplyCode as Code,
+ // a.InvCode,
+ // b.InvName,
+ // b.InvStd,
+ // b.InvUnit,
+ // SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ // a.WhCode,
+ // a.ExtensionID
+ // FROM
+ // ICSOApply a
+ // inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ // LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ // WHERE a.ApplyCode in ({0}) AND a.WorkPoint = '{1}'
+ // GROUP BY a.ApplyCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
+ // #endregion
+ // }
+
+ // if (Type == "7")
+ // {
+ // #region 销售发货SQL
+ // sqls = @" select
+ // x.MergeID,
+ // a.SDNCode as Code,
+ // a.InvCode,
+ // b.InvName,
+ // b.InvStd,
+ // b.InvUnit,
+ // SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ // a.WhCode,
+ // a.ExtensionID
+ // FROM
+ // ICSSDN a
+ // inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ // LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ // WHERE a.SDNCode in ({0}) AND a.WorkPoint = '{1}'
+ // GROUP BY a.SDNCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
+ // #endregion
+ // }
+ // if (Type == "8")
+ // {
+ // #region 其它出库SQL
+ // sqls = @" select
+ //x.MergeID,
+ // a.OutCode as Code,
+ // a.InvCode,
+ // b.InvName,
+ // b.InvStd,
+ // b.InvUnit,
+ // SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ // a.WhCode,
+ // a.ExtensionID
+ // FROM
+ // ICSOtherOut a
+ // inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ // LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ // WHERE a.OutCode in ({0}) AND a.WorkPoint = '{1}'
+ // GROUP BY a.OutCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
+ // #endregion
+ // }
+ // if (Type == "10")
+ // {
+ // #region 物料调拨
+ // sqls = @" select
+ //x.MergeID,
+ // a.TransferNO as Code,
+ // a.InvCode,
+ // b.InvName,
+ // b.InvStd,
+ // b.InvUnit,
+ // SUM(ISNULL(a.Quantity, 0)) AS iQuantity,
+ // a.FromWarehouseCode as WhCode,
+ // a.ExtensionID
+ // FROM
+ // ICSTransfer a
+ // inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
+ // LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
+ // WHERE a.TransferNO in ({0}) AND a.WorkPoint = '{1}'
+ // GROUP BY a.TransferNO,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.FromWarehouseCode,a.ExtensionID,x.MergeID";
+ // #endregion
+ // }
+
+ // sqls = string.Format(sqls, string.IsNullOrWhiteSpace(ID) ? "''" : ID.TrimEnd(','), WorkPoint);
+ // #region sql
+ // string sql = $@"SELECT row_number() over (order by c.Code,c.InvCode,d.MTIME,d.LotNO) AS rowNo,
+ // c.MergeID,
+ // c.Code,
+ // c.InvCode,
+ // c.InvName,
+ // c.InvStd,
+ // c.InvUnit,
+ // FLOOR(c.iQuantity) AS iQuantity,
+ // d.WarehouseCode,
+ // d.LocationCode,
+ // d.LotNO,
+ // FLOOR(ISNULL(d.Quantity, 0)) AS QTY,
+ // CONVERT(varchar(100),d.MTIME, 23) MTIME,
+ // FLOOR(f.QTYTotal) QTYTotal
+ // FROM
+ // ({sqls}) c
+ // left join (select d.WarehouseCode,d.Quantity,d.INVCode, m.LotNo, d.MTIME,d.LocationCode,m.ExtensionID
+ // from ICSWareHouseLotInfo d ,ICSInventoryLot m
+ // where d.LotNo=m.LotNo and d.WorkPoint=m.WorkPoint
+ // and d.WorkPoint='{WorkPoint}' AND d.Quantity>0 ) d
+ // on c.InvCode=d.INVCode AND c.WhCode=d.WarehouseCode and d.ExtensionID=c.ExtensionID
+ // LEFT JOIN (SELECT INVCode,WarehouseCode,SUM(Quantity) AS QTYTotal FROM ICSWareHouseLotInfo WHERE WorkPoint='{WorkPoint}' GROUP BY INVCode,WarehouseCode) f ON c.InvCode=f.INVCode AND c.WhCode=f.WarehouseCode
+ // order by c.Code,c.InvCode,d.MTIME ";
+ // #endregion
+ // var dataset = Repository().FindDataSetBySql(sql);
+ // if (dataset.Tables.Count == 0)
+ // return null;
+ // DataTable table = dataset.Tables[0];
+ // decimal qtyCount = 0;
+ // bool remove = false;
+ // List removeList = new List();
+ // for (int i = 0; i < table.Rows.Count; i++)
+ // {
+
+ // if (i != 0
+ // && (!table.Rows[i]["InvCode"].ToString().Equals(table.Rows[i - 1]["InvCode"].ToString())
+ // || !table.Rows[i]["Code"].ToString().Equals(table.Rows[i - 1]["Code"].ToString()))
+ // )
+ // {
+ // qtyCount = 0;
+ // remove = false;
+ // }
+ // if (remove)
+ // {
+ // removeList.Add(i);
+ // }
+ // else
+ // {
+ // var lotQty = table.Rows[i]["QTY"].ToString().ToDecimal();
+ // var orderQty = table.Rows[i]["iQuantity"].ToString().ToDecimal();
+ // qtyCount += lotQty;
+ // if (qtyCount >= orderQty)
+ // {
+ // remove = true;
+ // }
+ // }
+ // }
+ // if (removeList.Count > 0)
+ // {
+ // removeList.Reverse();
+ // foreach (var item in removeList)
+ // {
+ // table.Rows.RemoveAt(item);
+ // }
+ // }
+
+ // var result = ConvertCellToString(table);
+ // if (Invmes.Rows.Count > 0)
+ // {
+ // result.Merge(Invmes, false);
+ // }
+ // return result;
+ }
+ }
+ 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;
+
}
///
/// 验证箱号是否可用
diff --git a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
index 372befe..ab554f6 100644
--- a/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
+++ b/WMS-BS/NFine.Application/WMS/PickMaterialApp.cs
@@ -2134,7 +2134,7 @@ b.InvUnit,
ICSSDN a
inner join ICSMOPickMerge x on a.ID=x.SourceID and a.WorkPoint=x.WorkPoint
LEFT JOIN ICSINVENTORY b ON a.InvCode = b.InvCode AND a.WorkPoint=b.WorkPoint
- WHERE a.SDNCode in ({0}) AND a.WorkPoint = '{1}'
+ WHERE a.SDNCode in ({0}) AND a.WorkPoint = '{1}' AND a.Type='1'
GROUP BY a.SDNCode,a.InvCode,b.InvName,b.InvStd,b.InvUnit,a.WhCode,a.ExtensionID,x.MergeID";
#endregion
}