diff --git a/Infrastructure/Enums/BusinessType.cs b/Infrastructure/Enums/BusinessType.cs
index a4f09e1c..d8ad67c3 100644
--- a/Infrastructure/Enums/BusinessType.cs
+++ b/Infrastructure/Enums/BusinessType.cs
@@ -54,5 +54,9 @@
/// 清空数据
///
CLEAN = 9,
+ ///
+ /// 查询
+ ///
+ QUERY = 10,
}
}
diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs
index f1bab376..9360fa52 100644
--- a/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs
@@ -26,9 +26,9 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms
///
///
[HttpGet("production_warehouse_info")]
- public IActionResult Queryproduction_warehouse_info(string shelf = "", int layer = 0, int pageNum = 0, int pageSize = 0)
+ public IActionResult Queryproduction_warehouse_info(string shelf , int? layer , int pageNum = 0, int pageSize = 0)
{
- (List, int) data = wm_locationInfoService.Getwminfo_product(shelf, layer, pageNum, pageSize);
+ (List, int) data = wm_locationInfoService.Getwminfo_product(shelf, layer??0, pageNum, pageSize);
return ToResponse(new ApiResult(200, "success", data));
}
diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs
index b053f3cc..9cc54e90 100644
--- a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs
@@ -95,7 +95,7 @@ namespace ZR.Admin.WebApi.Controllers
[Log(Title = "成品库当前货物表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteWmGoodsNowProduction(string ids)
{
- int[] idsArr = Tools.SpitIntArrary(ids);
+ long[] idsArr = Tools.SpitLongArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _WmGoodsNowProductionService.Delete(idsArr);
diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs
index c2191ce2..adfe188e 100644
--- a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs
@@ -96,7 +96,7 @@ namespace ZR.Admin.WebApi.Controllers
[Log(Title = "出库货物记录表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteWmGoodsOutProduction(string ids)
{
- int[] idsArr = Tools.SpitIntArrary(ids);
+ long[] idsArr = Tools.SpitLongArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _WmGoodsOutProductionService.Delete(idsArr);
diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs
index ec6ea1d0..fddfb89f 100644
--- a/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs
@@ -107,6 +107,20 @@ namespace ZR.Admin.WebApi.Controllers
}
+ [HttpGet("getInfoByPatchCode")]
+ [Log(Title = "物料记录表", BusinessType = BusinessType.QUERY)]
+ public IActionResult GetInfoByPatchCode(string patchCode)
+ {
+ if (string.IsNullOrEmpty(patchCode))
+ {
+ return SUCCESS(null);
+ }
+ WmGoodsNowProduction nowProduction= _WmMaterialService.GetInfoByPatchCode(patchCode);
+ return SUCCESS(nowProduction);
+ }
+
+
+
}
diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs
index 95c6631d..d0577566 100644
--- a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs
@@ -6,6 +6,7 @@ using ZR.Service.mes.wms.IService;
using ZR.Model.MES.wms.Dto;
using ZR.Model.MES.wms;
using ZR.Service.mes.wms;
+using static System.Runtime.InteropServices.JavaScript.JSType;
//创建时间:2024-03-18
namespace ZR.Admin.WebApi.Controllers
@@ -150,6 +151,8 @@ namespace ZR.Admin.WebApi.Controllers
List data = _WmOutOrderService.Queryoutoder_matrials(shipment_num);
return SUCCESS(data);
}
+
+
///
/// 生成出货单的出货计划
///
@@ -166,7 +169,43 @@ namespace ZR.Admin.WebApi.Controllers
return SUCCESS(WmOutOrderPlanList);
}
+ ///
+ /// 5 成品出库
+ ///
+ ///
+ ///
+ ///
+ ///
+ [HttpPost("doMaterialOut")]
+ public IActionResult DoMaterialOut([FromBody] WmDoMaterialOut_Dto doMaterialOut)
+ {
+ if(doMaterialOut == null||doMaterialOut.ShipmentNum==null)
+ {
+ return SUCCESS(null);
+ }
+ (int,int) data= _WmOutOrderService.DoMaterialOut(doMaterialOut, HttpContext.GetName());
+
+ return SUCCESS(data);
+ }
+
+
+ ///
+ /// 6 出库单完成
+ ///
+ ///
+ ///
+ [HttpGet("over_outorderplan")]
+ public IActionResult OverOutorderplan(string shipment_num)
+ {
+ if (shipment_num == null)
+ {
+ return SUCCESS(null);
+ }
+
+ bool status = _WmOutOrderService.OverOutorderplan(shipment_num);
+ return SUCCESS(status);
+ }
}
}
\ No newline at end of file
diff --git a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs
index aa55e686..b5740f70 100644
--- a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs
+++ b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs
@@ -34,9 +34,16 @@ namespace ZR.Admin.WebApi.Filters
{
ApiResult response = new();
response.Code = (int)ResultCode.PARAM_ERROR;
-
+ // todo 模型校验
+ /*
+ 在.Net Core的时代中,框架会帮你自动验证model的state,也就是ModelState。
+ 框架会为你自动注册ModelStateInvalidFilter,
+ 这个会运行在OnActionExecuting事件里面。
+ */
var values = context.ModelState.Values;
- //todo 在干啥???
+
+ // return next();
+
foreach (var item in values)
{
foreach (var err in item.Errors)
@@ -64,7 +71,8 @@ namespace ZR.Admin.WebApi.Filters
}
///
- /// OnActionExecuted是在Action中的代码执行之后运行的方法。
+ /// 写入操作日志
+ /// OnActionExecuted是在Action中的代码执行之后运行的方法。
///
///
public override void OnResultExecuted(ResultExecutedContext context)
diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs
index c0b0a795..ddc59da6 100644
--- a/ZR.Admin.WebApi/Program.cs
+++ b/ZR.Admin.WebApi/Program.cs
@@ -2,6 +2,7 @@ using AspNetCoreRateLimit;
using Infrastructure;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.DataProtection;
+using Microsoft.AspNetCore.Mvc;
using Microsoft.IdentityModel.Tokens;
using System.Text.Json.Serialization;
using ZR.Admin.WebApi.AutoMapperProfile;
@@ -92,7 +93,11 @@ builder.Services.AddMvc(options =>
builder.Services.AddSwaggerConfig();
builder.Services.AddAutoMapper(typeof(AutoMapperProfile));
-
+//关闭参数自动校验,我们需要返回自定义的格式
+builder.Services.Configure((o) =>
+{
+ o.SuppressModelStateInvalidFilter = true;
+});
var app = builder.Build();
InternalApp.ServiceProvider = app.Services;
InternalApp.Configuration = builder.Configuration;
diff --git a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs
index 2c8d30de..fc2658de 100644
--- a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs
+++ b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs
@@ -28,7 +28,7 @@ namespace ZR.Model.MES.wms.Dto
///
/// 数量
///
- public string Quantity { get; set; }
+ public int? Quantity { get; set; }
///
/// 生产时间
diff --git a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs
index c4b45140..0d99bbd1 100644
--- a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs
+++ b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs
@@ -7,6 +7,36 @@ namespace ZR.Model.MES.wms.Dto
///
public class WmGoodsNowProductionQueryDto : PagerInfo
{
+ public string Id { get; set; }
+
+
+ public string PackageCode { get; set; }
+
+
+ public string PackageCodeClient { get; set; }
+
+ public string PackageCodeOriginal { get; set; }
+
+
+ public string LocationCode { get; set; }
+
+ public string Partnumber { get; set; }
+
+ public int? GoodsNumLogic { get; set; }
+
+ public int? GoodsNumAction { get; set; }
+
+ public DateTime? EntryWarehouseTime { get; set; }
+
+ public string Remark { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
}
///
@@ -17,15 +47,15 @@ namespace ZR.Model.MES.wms.Dto
[Required(ErrorMessage = "雪花id不能为空")]
public string Id { get; set; }
- [Required(ErrorMessage = "箱子编号(MES)不能为空")]
+
public string PackageCode { get; set; }
- [Required(ErrorMessage = "箱子编号(客户)不能为空")]
+
public string PackageCodeClient { get; set; }
public string PackageCodeOriginal { get; set; }
- [Required(ErrorMessage = "库位编号不能为空")]
+
public string LocationCode { get; set; }
public string Partnumber { get; set; }
diff --git a/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs
index 8094957d..8701623d 100644
--- a/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs
+++ b/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs
@@ -7,6 +7,41 @@ namespace ZR.Model.MES.wms.Dto
///
public class WmGoodsOutProductionQueryDto : PagerInfo
{
+
+ public string Id { get; set; }
+
+ public string FkNowProductionId { get; set; }
+
+ public string FkOutOrderId { get; set; }
+
+ public string PackageCode { get; set; }
+
+
+ public string PackageCodeClient { get; set; }
+
+ public string PackageCodeOriginal { get; set; }
+
+ public string LocationCode { get; set; }
+
+ public string Partnumber { get; set; }
+
+ public int? GoodsNumLogic { get; set; }
+
+ public int? GoodsNumAction { get; set; }
+
+ public DateTime? EntryWarehouseTime { get; set; }
+
+ public DateTime? OutTime { get; set; }
+
+ public string Remark { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
}
///
diff --git a/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs b/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs
index ba220f43..981312d1 100644
--- a/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs
+++ b/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs
@@ -68,6 +68,23 @@ namespace ZR.Model.MES.wms.Dto
}
+ // 出货到出货记录表
+ public class WmDoMaterialOut_Dto
+ {
+ ///
+ /// 出库单号
+ ///
+ public string ShipmentNum { get; set; }
+
+ ///
+ /// 批次号
+ ///
+ public string[] PatchCode { get; set; }
+
+
+ }
+
+
+
-
}
\ No newline at end of file
diff --git a/ZR.Model/MES/wms/WmCustom.cs b/ZR.Model/MES/wms/WmCustom.cs
index be91ec97..76cb175d 100644
--- a/ZR.Model/MES/wms/WmCustom.cs
+++ b/ZR.Model/MES/wms/WmCustom.cs
@@ -37,6 +37,7 @@ namespace ZR.Model.MES.wms
///
/// 备注
///
+ [SugarColumn(ColumnName = "remark")]
public string Remark { get; set; }
///
diff --git a/ZR.Model/MES/wms/WmInfo.cs b/ZR.Model/MES/wms/WmInfo.cs
index 0164207b..33f2e16a 100644
--- a/ZR.Model/MES/wms/WmInfo.cs
+++ b/ZR.Model/MES/wms/WmInfo.cs
@@ -40,6 +40,16 @@ namespace ZR.Model.MES.wms
///
[SugarColumn(ColumnName = "location")]
public string Location { get; set; }
+
+
+ ///
+ /// 备注
+ ///
+ [SugarColumn(ColumnName = "remark")]
+ public string Remark { get; set; }
+
+
+
///
/// 创建人
///
diff --git a/ZR.Service/mes/wms/IService/IWmMaterialService.cs b/ZR.Service/mes/wms/IService/IWmMaterialService.cs
index 0f745359..7d981b76 100644
--- a/ZR.Service/mes/wms/IService/IWmMaterialService.cs
+++ b/ZR.Service/mes/wms/IService/IWmMaterialService.cs
@@ -20,5 +20,7 @@ namespace ZR.Service.mes.wms.IService
int UpdateWmMaterial(WmMaterial parm);
+ WmGoodsNowProduction GetInfoByPatchCode(string patchCode);
+
}
}
diff --git a/ZR.Service/mes/wms/IService/IWmOutOrderService.cs b/ZR.Service/mes/wms/IService/IWmOutOrderService.cs
index fe5045fb..6e26ca1f 100644
--- a/ZR.Service/mes/wms/IService/IWmOutOrderService.cs
+++ b/ZR.Service/mes/wms/IService/IWmOutOrderService.cs
@@ -31,5 +31,10 @@ namespace ZR.Service.mes.wms.IService
List Generate_outorderplan(string shipment_num);
+ (int, int) DoMaterialOut(WmDoMaterialOut_Dto doMaterialOut, string Createby);
+
+
+ bool OverOutorderplan(string shipment_num);
+
}
}
diff --git a/ZR.Service/mes/wms/WMExitwarehouseService.cs b/ZR.Service/mes/wms/WMExitwarehouseService.cs
index 2f4d1a36..c5de5806 100644
--- a/ZR.Service/mes/wms/WMExitwarehouseService.cs
+++ b/ZR.Service/mes/wms/WMExitwarehouseService.cs
@@ -76,7 +76,7 @@ namespace ZR.Service.mes.wms
resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6);
//todo 解析箱子中产品数量
string product_num = splitstr[3].Substring(4);
- resultionPackageCode.Quantity = product_num;
+ resultionPackageCode.Quantity = int.Parse(product_num);
//todo 产品描述 partnumber
// ProWorklplan_v2 plan= Context.Queryable().Where(it => it.Partnumber == partnumber).First();
//if(plan != null)
diff --git a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs
index bf434038..ad804ecd 100644
--- a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs
+++ b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs
@@ -62,9 +62,11 @@ namespace ZR.Service.mes.wms
string workorder_id = resultionPackage.WorkoderID;
- wmGood.GoodsNumLogic = Context.Queryable()
- .Where(it => it.WorkOrderNum == workorder_id)
- .Count();
+ //wmGood.GoodsNumLogic = Context.Queryable()
+ // .Where(it => it.WorkOrderNum == workorder_id)
+ // .Count();
+
+ wmGood.GoodsNumLogic = (resultionPackage.Quantity)??0;
wmGood.GoodsNumAction= wmGood.GoodsNumLogic;
wmGood.EntryWarehouseTime = DateTime.Now;
wmGood.CreatedBy = createName;
@@ -217,7 +219,7 @@ namespace ZR.Service.mes.wms
resultionPackageCode.ProductionTime="20"+ workoderidid.Substring(0,6);
//todo 解析箱子中产品数量
string product_num = splitstr[3].Substring(4);
- resultionPackageCode.Quantity = product_num;
+ resultionPackageCode.Quantity = int.Parse(product_num);
//todo 产品描述 partnumber
// ProWorklplan_v2 plan= Context.Queryable().Where(it => it.Partnumber == partnumber).First();
//if(plan != null)
@@ -228,7 +230,9 @@ namespace ZR.Service.mes.wms
// {
// resultionPackageCode.ProductionDescribe = "生产计划无此零件号";
// }
- ProWorkorder_v2 workorder= Context.Queryable().Where(it => it.FinishedPartNumber == partnumber).First();
+ ProWorkorder_v2 workorder= Context.Queryable()
+ .Where(it => it.FinishedPartNumber == partnumber)
+ .First();
if (workorder != null)
{
diff --git a/ZR.Service/mes/wms/WMlocationInfoService.cs b/ZR.Service/mes/wms/WMlocationInfoService.cs
index fa759a8b..dfed8e5d 100644
--- a/ZR.Service/mes/wms/WMlocationInfoService.cs
+++ b/ZR.Service/mes/wms/WMlocationInfoService.cs
@@ -40,7 +40,7 @@ namespace ZR.Service.mes.wms
{
int totalNum = 0;
var predicate = Expressionable.Create()
- .AndIF(!string.IsNullOrEmpty(shelf), it => it.Shelf == shelf)
+ .AndIF(!string.IsNullOrEmpty(shelf), it => it.Shelf.Contains(shelf))
.AndIF(layer > 0, it => it.Layer == layer)
.ToExpression();
List product_wminfoList = Context.Queryable().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
diff --git a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs
index 67116052..70dfaeec 100644
--- a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs
+++ b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs
@@ -25,7 +25,11 @@ namespace ZR.Service.mes.wms
///
public PagedInfo GetList(WmGoodsNowProductionQueryDto parm)
{
- var predicate = Expressionable.Create();
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
+ .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient))
+ .AndIF(!string.IsNullOrEmpty(parm.LocationCode), it => it.LocationCode.Contains(parm.LocationCode))
+ ;
var response = Queryable()
.Where(predicate.ToExpression())
diff --git a/ZR.Service/mes/wms/WmGoodsOutProductionService.cs b/ZR.Service/mes/wms/WmGoodsOutProductionService.cs
index b0a7242b..78ada568 100644
--- a/ZR.Service/mes/wms/WmGoodsOutProductionService.cs
+++ b/ZR.Service/mes/wms/WmGoodsOutProductionService.cs
@@ -26,7 +26,12 @@ namespace ZR.Service.mes.wms
///
public PagedInfo GetList(WmGoodsOutProductionQueryDto parm)
{
- var predicate = Expressionable.Create();
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.Partnumber),it=>it.Partnumber.Contains(parm.Partnumber))
+ .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient),it=>it.PackageCodeClient.Contains(parm.PackageCodeClient))
+ .AndIF(!string.IsNullOrEmpty(parm.LocationCode),it=>it.LocationCode.Contains(parm.LocationCode))
+ .AndIF(!string.IsNullOrEmpty(parm.FkOutOrderId),it=>it.FkOutOrderId.Contains(parm.FkOutOrderId))
+ ;
var response = Queryable()
.Where(predicate.ToExpression())
diff --git a/ZR.Service/mes/wms/WmMaterialService.cs b/ZR.Service/mes/wms/WmMaterialService.cs
index e844ea36..0ccc5caf 100644
--- a/ZR.Service/mes/wms/WmMaterialService.cs
+++ b/ZR.Service/mes/wms/WmMaterialService.cs
@@ -104,5 +104,17 @@ namespace ZR.Service.mes.wms
return Update(model, true);
}
+ ///
+ /// 通过外箱标签解析后得到的批次号,获取货物仓库内的货物信息
+ ///
+ ///
+ ///
+ ///
+ public WmGoodsNowProduction GetInfoByPatchCode(string patchCode)
+ {
+ return Context.Queryable()
+ .Where(it => it.PackageCodeClient == patchCode).First();
+
+ }
}
}
\ No newline at end of file
diff --git a/ZR.Service/mes/wms/WmOutOrderService.cs b/ZR.Service/mes/wms/WmOutOrderService.cs
index c59db9fe..fdda9514 100644
--- a/ZR.Service/mes/wms/WmOutOrderService.cs
+++ b/ZR.Service/mes/wms/WmOutOrderService.cs
@@ -65,9 +65,13 @@ namespace ZR.Service.mes.wms
foreach (var moItem in moList)
{
WmMaterial material = Context.Queryable().Where(it => it.Id == moItem.FkMaterialId).First();
- WmMaterialQuery_stockQuantityDto2 dto2 = material.Adapt();
- dto2.requireOutNum = moItem.OuthouseNum;
- Material_stock.Add(dto2);
+ if(material != null)
+ {
+ WmMaterialQuery_stockQuantityDto2 dto2 = material.Adapt();
+ dto2.requireOutNum = moItem.OuthouseNum;
+ Material_stock.Add(dto2);
+ }
+
}
wmOutOrderItem.MaterialList = Material_stock;
}
@@ -347,10 +351,10 @@ namespace ZR.Service.mes.wms
List wmGoodsNowsList = Context.Queryable().Where(it => it.Partnumber == partnumber)
.OrderByDescending(it => it.PackageCodeClient).ToList();
- foreach(var witem in wmGoodsNowsList)
+ foreach (var witem in wmGoodsNowsList)
{
int accumulation_num = 0;
- if (require_num>= accumulation_num)
+ if (require_num >= accumulation_num)
{
WmOutOrderPlan orderPlan = new WmOutOrderPlan();
orderPlan.FkOutOrderId = shipment_num;
@@ -358,13 +362,13 @@ namespace ZR.Service.mes.wms
orderPlan.Patchcode = witem.PackageCodeClient;
orderPlan.MaterialCode = witem.Partnumber;
orderPlan.WarehouseCode = witem.LocationCode;
- orderPlan.PackageNum =int.Parse( witem.PackageCodeClient.Split("_")[1] );
+ orderPlan.PackageNum = int.Parse(witem.PackageCodeClient.Split("_")[1]);
orderPlan.RequireNum = require_num;
orderPlan.Patchtime = Resolution_bath(witem.PackageCodeClient);
wmOutOrderPlans.Add(orderPlan);
- accumulation_num = accumulation_num+ witem.GoodsNumLogic??0;
-
+ accumulation_num = accumulation_num + witem.GoodsNumLogic ?? 0;
+
}
else
{ //超了
@@ -391,6 +395,71 @@ namespace ZR.Service.mes.wms
}
+ ///
+ /// 根据出库单号与货物批次号,向出库记录添加数据,并且成品库表数据删除
+ ///
+ ///
+ ///
+ public (int,int) DoMaterialOut(WmDoMaterialOut_Dto doMaterialOut, string Createby)
+ {
+ int sum_delete = 0;
+ int sum_insert = 0;
+ string shipnumber = doMaterialOut.ShipmentNum;
+ if(doMaterialOut.PatchCode!=null&& doMaterialOut.PatchCode.Length > 0)
+ {
+ foreach(var item in doMaterialOut.PatchCode)
+ {
+ UseTran2(() =>
+ {
+ WmGoodsOutRecord record = new WmGoodsOutRecord();
+ record.Id = SnowFlakeSingle.Instance.NextId().ToString();
+ WmGoodsNowProduction nowProduction = Context.Queryable()
+ .Where(it => it.PackageCodeClient == item).First();
+
+ if (nowProduction != null)
+ {
+ record.FkNowProductionId = nowProduction.Id;
+ record.PackageCodeClient= nowProduction.PackageCodeClient;
+ record.PackageCode = nowProduction.PackageCode;
+ record.PackageCodeOriginal = nowProduction.PackageCodeOriginal;
+ record.LocationCode = nowProduction.LocationCode;
+ record.Partnumber = nowProduction.Partnumber;
+ record.GoodsNumLogic = nowProduction.GoodsNumLogic;
+ record.GoodsNumAction = nowProduction.GoodsNumAction;
+ record.EntryWarehouseTime = nowProduction.EntryWarehouseTime;
+ record.OutTime = DateTime.Now;
+ record.CreatedTime = DateTime.Now;
+ record.CreatedBy = Createby;
+ record.FkOutOrderId = shipnumber;
+ sum_insert= Context.Insertable(record).ExecuteCommand();
+ sum_delete+= Context.Deleteable()
+ .Where(it => it.PackageCodeClient == item)
+ .ExecuteCommand();
+ }
+
+
+ });
+
+ }
+ }
+ return (sum_delete, sum_insert);
+ }
+
+ public bool OverOutorderplan(string shipment_num)
+ {
+ int reult= Context.Updateable().Where(it=>it.ShipmentNum==shipment_num)
+ .SetColumns(it => it.Type == 2)
+ .ExecuteCommand();
+ if(reult>0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
///
/// 传入批次号 解析出时间 BNW240318007_105
///