|
|
@ -28,6 +28,8 @@ using VOL.Core.Services;
|
|
|
|
using ConvertHelper;
|
|
|
|
using ConvertHelper;
|
|
|
|
using static VOL.Entity.DomainModels.OP_WMS_TRUCK;
|
|
|
|
using static VOL.Entity.DomainModels.OP_WMS_TRUCK;
|
|
|
|
using VOL.Core.Configuration;
|
|
|
|
using VOL.Core.Configuration;
|
|
|
|
|
|
|
|
using FastReport.Editor;
|
|
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
|
|
namespace VOL.WMS.Services
|
|
|
|
namespace VOL.WMS.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -256,6 +258,10 @@ namespace VOL.WMS.Services
|
|
|
|
public List<INFO_FILES> Table4List { get; set; }
|
|
|
|
public List<INFO_FILES> Table4List { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public List<VW_OP_TRUCK_FILE> Table5List { get; set; }
|
|
|
|
public List<VW_OP_TRUCK_FILE> Table5List { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 出库条件
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
public List<Op_Wms_Logic> Table6List { get; set; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -444,6 +450,83 @@ namespace VOL.WMS.Services
|
|
|
|
if (!_r.Status) return _r;
|
|
|
|
if (!_r.Status) return _r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Op_Wms_Logic> ConditionList = tableExtra.Table6List;
|
|
|
|
|
|
|
|
if (!ConditionList.isNullorEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var dealedconditionlist = new List<List<Op_Wms_Logic>>();
|
|
|
|
|
|
|
|
dealedconditionlist = DealBodyList(head.WMSPLANID, ConditionList, "OP_WMS_OUT_PLAN");
|
|
|
|
|
|
|
|
//var _r = AddTruckFile(saveDataModel, dealedbodylist2[0], dealedbodylist2[1], FileList, head);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (!_r.Status) return _r;
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.AddRange(dealedconditionlist[0]);
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.UpdateRange(dealedconditionlist[1]);
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
#region 产生条件出库范围
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 物理库存List = Vw_Op_Wms_PhysicsRepository.Instance.FindAsIQueryable(x => (x.KGS > 0 || x.CBM > 0 || x.PKGS > 0 || x.STORAGEUNITCOUNT > 0)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in ConditionList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (item.VALUE == "MBLNO")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.MBLNO == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "GOODSMODEL")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.GOODSMODEL == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "GOODSMODEL2")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.GOODSMODEL2 == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "GOODSMODEL3")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.GOODSMODEL3 == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "GOODSMODEL4")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.GOODSMODEL4 == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "OLD_CNTRNO")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.OLD_CNTRNO == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "CUSTOMERNAME")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.CUSTOMERNAME == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (item.VALUE == "GOODSOWNER")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.GOODSOWNER == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//找到目前出库计划里已有的计划明细
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var batchList = Op_Wms_LogicRepository.Instance.FindAsIQueryable(x => x.PID == head.WMSPLANID && x.NAME == "批量出库范围").ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in 物理库存List)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (batchList.Where(x => batchList.Select(s => Guid.Parse(s.VALUE)).Contains(item.WMSPHYSICSID)).Count() > 0) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var logic = new Op_Wms_Logic()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WMSLOGICID = new Guid(),
|
|
|
|
|
|
|
|
WMSID = item.WMSID,
|
|
|
|
|
|
|
|
PID = head.WMSPLANID,
|
|
|
|
|
|
|
|
VALUE = item.WMSPHYSICSID.ToString(),
|
|
|
|
|
|
|
|
NAME = "批量出库范围"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.Add(logic);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Logger.ADD_PUB("出库通知", head, saveDataModel.Extra.ToString());
|
|
|
|
Logger.ADD_PUB("出库通知", head, saveDataModel.Extra.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
return WebResponseContent.Instance.OK();
|
|
|
|
return WebResponseContent.Instance.OK();
|
|
|
@ -509,14 +592,14 @@ namespace VOL.WMS.Services
|
|
|
|
LockList.Remove(headid);
|
|
|
|
LockList.Remove(headid);
|
|
|
|
return _webResponse;
|
|
|
|
return _webResponse;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//取值 是否批次出库
|
|
|
|
//取值 是否条件出库
|
|
|
|
var isBatchStock = saveModel.getMainDataValueStr("ISBATCHSTOCK") == "1" ? true : false;
|
|
|
|
var isBatchStock = saveModel.getMainDataValueStr("ISBATCHSTOCK") == "1" ? true : false;
|
|
|
|
var outplan = OP_WMS_OUT_PLANRepository.Instance.FindFirst(x => x.WMSPLANID ==Guid.Parse(headid));
|
|
|
|
var outplan = OP_WMS_OUT_PLANRepository.Instance.FindFirst(x => x.WMSPLANID ==Guid.Parse(headid));
|
|
|
|
|
|
|
|
|
|
|
|
if (outplan.ISBATCHSTOCK != isBatchStock)
|
|
|
|
if (outplan.ISBATCHSTOCK != isBatchStock)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LockList.Remove(headid);
|
|
|
|
LockList.Remove(headid);
|
|
|
|
return _webResponse.Error("批量出库标识不一致,请恢复");
|
|
|
|
return _webResponse.Error("条件出库标识不一致,请恢复");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//取出校验完成后的从表1.2的数据
|
|
|
|
//取出校验完成后的从表1.2的数据
|
|
|
@ -616,6 +699,63 @@ namespace VOL.WMS.Services
|
|
|
|
if (!_r.Status) return _r;
|
|
|
|
if (!_r.Status) return _r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Op_Wms_Logic> ConditionList = tableExtra.Table6List;
|
|
|
|
|
|
|
|
if (!ConditionList.isNullorEmpty())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var dealedconditionlist = new List<List<Op_Wms_Logic>>();
|
|
|
|
|
|
|
|
dealedconditionlist = DealBodyList(head.WMSPLANID, ConditionList, "OP_WMS_OUT_PLAN");
|
|
|
|
|
|
|
|
//var _r = AddTruckFile(saveDataModel, dealedbodylist2[0], dealedbodylist2[1], FileList, head);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (!_r.Status) return _r;
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.AddRange(dealedconditionlist[0]);
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.UpdateRange(dealedconditionlist[1]);
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
#region 产生条件出库范围
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var 物理库存List = Vw_Op_Wms_PhysicsRepository.Instance.FindAsIQueryable(x => (x.KGS > 0 || x.CBM > 0 || x.PKGS > 0 || x.STORAGEUNITCOUNT > 0)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in ConditionList)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (item.VALUE == "MBLNO")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
物理库存List = 物理库存List.Where(x => x.MBLNO == item.VALUE2).ToList();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//找到目前出库计划里已有的计划明细
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var batchList = Op_Wms_LogicRepository.Instance.FindAsIQueryable(x => x.PID == head.WMSPLANID && x.NAME == "批量出库范围").ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string sql = $"DELETE FROM Op_Wms_Logic where PID ='{head.WMSPLANID}' AND NAME ='批量出库范围';";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.ExecuteSqlCommand(sql);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//foreach (var item in batchList)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// Op_Wms_LogicRepository.Instance.Delete(item);
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
//Op_Wms_LogicRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in 物理库存List)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//if (batchList.Where(x => batchList.Select(s => Guid.Parse(s.VALUE)).Contains(item.WMSPHYSICSID)).Count() > 0) continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var logic = new Op_Wms_Logic()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
WMSLOGICID = new Guid(),
|
|
|
|
|
|
|
|
WMSID = item.WMSID,
|
|
|
|
|
|
|
|
PID = head.WMSPLANID,
|
|
|
|
|
|
|
|
VALUE = item.WMSPHYSICSID.ToString(),
|
|
|
|
|
|
|
|
NAME = "批量出库范围"
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.Add(logic);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Op_Wms_LogicRepository.Instance.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
|
|
Logger.ADD_PUB("出库通知", head, saveModel.Extra.ToString());
|
|
|
|
Logger.ADD_PUB("出库通知", head, saveModel.Extra.ToString());
|
|
|
|
|
|
|
|
|
|
|
|
return WebResponseContent.Instance.OK();
|
|
|
|
return WebResponseContent.Instance.OK();
|
|
|
@ -693,6 +833,9 @@ namespace VOL.WMS.Services
|
|
|
|
return _webResponse.OK("保存成功");
|
|
|
|
return _webResponse.OK("保存成功");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public WebResponseContent GetNewOutPlan() {
|
|
|
|
public WebResponseContent GetNewOutPlan() {
|
|
|
|
var result = new OP_WMS_OUT_PLAN();
|
|
|
|
var result = new OP_WMS_OUT_PLAN();
|
|
|
|
|
|
|
|
|
|
|
@ -1210,7 +1353,7 @@ namespace VOL.WMS.Services
|
|
|
|
{
|
|
|
|
{
|
|
|
|
keys[i] = outplangoods_list[i].WMSOUTDETAILID.ToString();
|
|
|
|
keys[i] = outplangoods_list[i].WMSOUTDETAILID.ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//只有正常业务才产生出库明细 批次出库不用产生
|
|
|
|
//只有正常业务才产生出库明细 条件出库不用产生
|
|
|
|
if (!(bool)head.ISBATCHSTOCK)
|
|
|
|
if (!(bool)head.ISBATCHSTOCK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<VW_OP_WMS_OUT_DO_GOODS> outdogoods_list = VW_OP_WMS_OUT_DO_GOODSRepository.Instance.FindAsIQueryable(x => x.WMSPLANDETAILID == new Guid(keys[0])).ToList();
|
|
|
|
List<VW_OP_WMS_OUT_DO_GOODS> outdogoods_list = VW_OP_WMS_OUT_DO_GOODSRepository.Instance.FindAsIQueryable(x => x.WMSPLANDETAILID == new Guid(keys[0])).ToList();
|
|
|
@ -1481,7 +1624,7 @@ namespace VOL.WMS.Services
|
|
|
|
|
|
|
|
|
|
|
|
if (outplan != null && outplan.ISBATCHSTOCK != isBatchStock)
|
|
|
|
if (outplan != null && outplan.ISBATCHSTOCK != isBatchStock)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return _webResponse.Error("批量出库标识不一致,请恢复");
|
|
|
|
return _webResponse.Error("条件出库标识不一致,请恢复");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isBatchStock) //原有业务逻辑
|
|
|
|
if (!isBatchStock) //原有业务逻辑
|
|
|
@ -1575,7 +1718,7 @@ namespace VOL.WMS.Services
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 批次出库逻辑
|
|
|
|
// 条件出库逻辑
|
|
|
|
//找到目前出库计划里已有的计划明细
|
|
|
|
//找到目前出库计划里已有的计划明细
|
|
|
|
|
|
|
|
|
|
|
|
var batchList = Op_Wms_LogicRepository.Instance.FindAsIQueryable(x => x.PID == wmsplanid).ToList();
|
|
|
|
var batchList = Op_Wms_LogicRepository.Instance.FindAsIQueryable(x => x.PID == wmsplanid).ToList();
|
|
|
@ -1884,7 +2027,7 @@ namespace VOL.WMS.Services
|
|
|
|
else
|
|
|
|
else
|
|
|
|
if (ctninfo.Count > 0)
|
|
|
|
if (ctninfo.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//只有正常业务才产生出库明细 批次出库不用产生
|
|
|
|
//只有正常业务才产生出库明细 条件出库不用产生
|
|
|
|
if (!(bool)head.ISBATCHSTOCK)
|
|
|
|
if (!(bool)head.ISBATCHSTOCK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MakeOutDoDetail(head, ctninfo, newoutdo.WMSDOID);
|
|
|
|
MakeOutDoDetail(head, ctninfo, newoutdo.WMSDOID);
|
|
|
|