2025-07-28 15:40:59 +08:00
|
|
|
|
using Infrastructure.Attribute;
|
|
|
|
|
|
using Mapster;
|
|
|
|
|
|
using SqlSugar;
|
2024-06-07 11:04:26 +08:00
|
|
|
|
using System;
|
2024-03-22 08:54:11 +08:00
|
|
|
|
using System.Data;
|
2024-03-26 14:19:01 +08:00
|
|
|
|
using System.Linq;
|
2025-06-02 09:15:26 +08:00
|
|
|
|
using System.Text.RegularExpressions;
|
2025-06-22 09:19:56 +08:00
|
|
|
|
using System.Threading.Tasks;
|
2024-06-07 11:04:26 +08:00
|
|
|
|
using ZR.Model;
|
|
|
|
|
|
using ZR.Model.MES.wms;
|
|
|
|
|
|
using ZR.Model.MES.wms.Dto;
|
|
|
|
|
|
using ZR.Repository;
|
|
|
|
|
|
using ZR.Service.mes.wms.IService;
|
2025-06-09 18:14:52 +08:00
|
|
|
|
using ZR.Service.mes.wms_u8;
|
2024-03-28 11:17:18 +08:00
|
|
|
|
using ZR.Service.Utils;
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
namespace ZR.Service.mes.wms
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 出货单(物料+客户)Service业务层处理
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[AppService(ServiceType = typeof(IWmOutOrderService), ServiceLifetime = LifeTime.Transient)]
|
|
|
|
|
|
public class WmOutOrderService : BaseService<WmOutOrder>, IWmOutOrderService
|
|
|
|
|
|
{
|
2024-04-30 14:18:00 +08:00
|
|
|
|
private NLog.Logger logger;
|
2024-08-05 17:25:52 +08:00
|
|
|
|
|
2024-04-30 14:18:00 +08:00
|
|
|
|
public WmOutOrderService()
|
|
|
|
|
|
{
|
|
|
|
|
|
logger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
}
|
2024-04-14 11:16:19 +08:00
|
|
|
|
|
2024-03-19 11:08:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询出货单(物料+客户)列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public PagedInfo<WmOutOrderDto> GetList(WmOutOrderQueryDto parm)
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var predicate = Expressionable
|
|
|
|
|
|
.Create<WmOutOrder>()
|
|
|
|
|
|
.AndIF(
|
|
|
|
|
|
!string.IsNullOrEmpty(parm.ShipmentNum),
|
|
|
|
|
|
it => it.ShipmentNum.Contains(parm.ShipmentNum)
|
|
|
|
|
|
)
|
|
|
|
|
|
.AndIF(
|
|
|
|
|
|
!string.IsNullOrEmpty(parm.CustomNo),
|
|
|
|
|
|
it => it.CustomNo.Contains(parm.CustomNo)
|
|
|
|
|
|
)
|
2024-04-29 17:00:38 +08:00
|
|
|
|
.AndIF(parm.Type > 0, it => it.Type == parm.Type)
|
|
|
|
|
|
.AndIF(parm.Status > -1, it => it.Status == parm.Status)
|
2024-04-14 11:16:19 +08:00
|
|
|
|
.AndIF(parm.Year > 0, it => it.Year == parm.Year)
|
|
|
|
|
|
.AndIF(parm.Week > 0, it => it.Year == parm.Week)
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.AndIF(parm.Date > 0, it => it.Year == parm.Date);
|
2024-03-19 11:08:28 +08:00
|
|
|
|
var response = Queryable()
|
|
|
|
|
|
.Where(predicate.ToExpression())
|
2024-05-14 10:31:24 +08:00
|
|
|
|
.OrderByDescending(it => it.CreatedTime)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
.ToPage<WmOutOrder, WmOutOrderDto>(parm);
|
|
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="ShipmentNum"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public WmOutOrder_material_num GetInfo(string ShipmentNum)
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
WmOutOrder WmOutOrderList = Context
|
|
|
|
|
|
.Queryable<WmOutOrder>()
|
|
|
|
|
|
.Where(it => it.ShipmentNum == ShipmentNum)
|
|
|
|
|
|
.First();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
WmOutOrder_material_num wmOutOrderItem = null;
|
|
|
|
|
|
|
|
|
|
|
|
if (WmOutOrderList != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
wmOutOrderItem = WmOutOrderList.Adapt<WmOutOrder_material_num>();
|
|
|
|
|
|
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterialOutorder> moList = Context
|
|
|
|
|
|
.Queryable<WmMaterialOutorder>()
|
|
|
|
|
|
.Where(it => it.FkOutorderId == WmOutOrderList.ShipmentNum)
|
|
|
|
|
|
.ToList();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
if (moList != null && moList.Count > 0)
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterialQuery_stockQuantityDto2> Material_stock =
|
|
|
|
|
|
new List<WmMaterialQuery_stockQuantityDto2>();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var moItem in moList)
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
WmMaterial material = Context
|
|
|
|
|
|
.Queryable<WmMaterial>()
|
|
|
|
|
|
.Where(it => it.Id == moItem.FkMaterialId)
|
|
|
|
|
|
.First();
|
2024-03-26 14:19:01 +08:00
|
|
|
|
if (material != null)
|
2024-03-23 14:31:50 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
WmMaterialQuery_stockQuantityDto2 dto2 =
|
|
|
|
|
|
material.Adapt<WmMaterialQuery_stockQuantityDto2>();
|
2024-03-23 14:31:50 +08:00
|
|
|
|
dto2.requireOutNum = moItem.OuthouseNum;
|
|
|
|
|
|
Material_stock.Add(dto2);
|
|
|
|
|
|
}
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
wmOutOrderItem.MaterialList = Material_stock;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return wmOutOrderItem;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加出货单(物料+客户)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public WmOutOrder AddWmOutOrder(WmOutOrder_materialDto model)
|
|
|
|
|
|
{
|
2024-04-24 09:46:35 +08:00
|
|
|
|
try
|
2024-03-19 11:08:28 +08:00
|
|
|
|
{
|
2024-04-24 09:46:35 +08:00
|
|
|
|
string today_id = "EG" + DateTime.Now.ToString("yyMMdd");
|
2024-08-05 17:25:52 +08:00
|
|
|
|
string last_outorder_ShipmentNum = Context
|
|
|
|
|
|
.Queryable<WmOutOrder>()
|
|
|
|
|
|
.Where(it => it.ShipmentNum.StartsWith(today_id))
|
|
|
|
|
|
.Max(it => it.ShipmentNum);
|
2024-04-24 09:46:35 +08:00
|
|
|
|
if (string.IsNullOrEmpty(last_outorder_ShipmentNum))
|
|
|
|
|
|
{
|
|
|
|
|
|
model.ShipmentNum = today_id + "001";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
int flow =
|
|
|
|
|
|
int.Parse(
|
|
|
|
|
|
last_outorder_ShipmentNum.Substring(
|
|
|
|
|
|
last_outorder_ShipmentNum.Length - 3,
|
|
|
|
|
|
3
|
|
|
|
|
|
)
|
|
|
|
|
|
) + 1;
|
2024-04-24 09:46:35 +08:00
|
|
|
|
model.ShipmentNum = today_id + flow.ToString("000");
|
|
|
|
|
|
}
|
|
|
|
|
|
WmOutOrder wmOutOrder = model.Adapt<WmOutOrder>();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
2024-04-24 09:46:35 +08:00
|
|
|
|
// 关联表也要新增
|
|
|
|
|
|
if (model.MaterialList != null)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
{
|
2024-04-24 09:46:35 +08:00
|
|
|
|
if (model.MaterialList.Count > 0)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterialOutorder> materialOutorderList =
|
|
|
|
|
|
new List<WmMaterialOutorder>();
|
2024-04-24 09:46:35 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var item in model.MaterialList)
|
|
|
|
|
|
{
|
|
|
|
|
|
WmMaterialOutorder materialOutorder = new WmMaterialOutorder();
|
|
|
|
|
|
materialOutorder.FkMaterialId = item.Id;
|
|
|
|
|
|
materialOutorder.FkOutorderId = model.ShipmentNum;
|
|
|
|
|
|
materialOutorder.OuthouseNum = item.requireOutNum;
|
|
|
|
|
|
materialOutorder.CreatedBy = model.CreatedBy;
|
|
|
|
|
|
materialOutorder.CreatedTime = DateTime.Now;
|
|
|
|
|
|
materialOutorderList.Add(materialOutorder);
|
2024-08-05 17:25:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
;
|
2024-04-24 09:46:35 +08:00
|
|
|
|
int result = Context.Insertable(materialOutorderList).ExecuteCommand();
|
|
|
|
|
|
}
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-24 09:46:35 +08:00
|
|
|
|
return Context.Insertable(wmOutOrder).ExecuteReturnEntity();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
2025-06-02 09:15:26 +08:00
|
|
|
|
catch (Exception)
|
2024-04-24 09:46:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
2024-08-05 17:25:52 +08:00
|
|
|
|
|
2024-04-09 14:03:10 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除出货单关联的物料出货单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="primarys"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-04-14 11:16:19 +08:00
|
|
|
|
public int Delete_fk_matrial(string[] primarys)
|
2024-04-09 14:03:10 +08:00
|
|
|
|
{
|
2024-04-14 11:16:19 +08:00
|
|
|
|
if (primarys.Count() > 0)
|
2024-04-09 14:03:10 +08:00
|
|
|
|
{
|
2024-04-14 11:16:19 +08:00
|
|
|
|
for (int i = 0; i < primarys.Length; i++)
|
2024-04-09 14:03:10 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
Context
|
|
|
|
|
|
.Deleteable<WmMaterialOutorder>()
|
|
|
|
|
|
.Where(it => it.FkOutorderId == primarys[i])
|
|
|
|
|
|
.ExecuteCommand();
|
2024-04-09 14:03:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 修改出货单(物料+客户)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public int UpdateWmOutOrder(WmOutOrder model)
|
|
|
|
|
|
{
|
|
|
|
|
|
//var response = Update(w => w.ShipmentNum == model.ShipmentNum, it => new WmOutOrder()
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CustomNo = model.CustomNo,
|
|
|
|
|
|
// CustomName = model.CustomName,
|
|
|
|
|
|
// CustomAddress = model.CustomAddress,
|
|
|
|
|
|
// Remarks = model.Remarks,
|
|
|
|
|
|
// Type = model.Type,
|
|
|
|
|
|
// Status = model.Status,
|
|
|
|
|
|
// Year = model.Year,
|
|
|
|
|
|
// Week = model.Week,
|
|
|
|
|
|
// Date = model.Date,
|
|
|
|
|
|
// CreatedBy = model.CreatedBy,
|
|
|
|
|
|
// CreatedTime = model.CreatedTime,
|
|
|
|
|
|
// UpdatedBy = model.UpdatedBy,
|
|
|
|
|
|
// UpdatedTime = model.UpdatedTime,
|
|
|
|
|
|
//});
|
|
|
|
|
|
//return response;
|
|
|
|
|
|
return Update(model, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取用户信息
|
|
|
|
|
|
/// </summary>
|
2024-08-05 17:25:52 +08:00
|
|
|
|
/// <returns></returns>
|
2024-03-19 11:08:28 +08:00
|
|
|
|
public List<WmCustom> GetCustominfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
return Context.Queryable<WmCustom>().ToList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询物料记录表列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-08-05 17:25:52 +08:00
|
|
|
|
public (List<WmMaterialQuery_stockQuantityDto>, int) GetmaterialList(
|
|
|
|
|
|
WmMaterialQueryDto parm
|
|
|
|
|
|
)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
int total = 0;
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var predicate = Expressionable
|
|
|
|
|
|
.Create<WmMaterial>()
|
2024-03-19 11:08:28 +08:00
|
|
|
|
.AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber))
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.AndIF(
|
|
|
|
|
|
parm.U8InventoryCode != null,
|
|
|
|
|
|
it => it.U8InventoryCode.Contains(parm.U8InventoryCode)
|
|
|
|
|
|
)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
.AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName))
|
|
|
|
|
|
.AndIF(parm.Color != null, it => it.Color.Contains(parm.Color))
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.AndIF(
|
|
|
|
|
|
parm.Specification != null,
|
|
|
|
|
|
it => it.Specification.Contains(parm.Specification)
|
|
|
|
|
|
)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
.AndIF(parm.Description != null, it => it.Description.Contains(parm.Description))
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.AndIF(
|
|
|
|
|
|
parm.Search1 != null,
|
|
|
|
|
|
it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1)
|
|
|
|
|
|
)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
.AndIF(parm.Status > -1, it => it.Status == parm.Status);
|
|
|
|
|
|
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterial> materialList = Context
|
|
|
|
|
|
.Queryable<WmMaterial>()
|
2024-04-09 14:03:10 +08:00
|
|
|
|
.Where(predicate.ToExpression())
|
|
|
|
|
|
.OrderByDescending(it => it.CreatedTime)
|
2024-03-19 11:08:28 +08:00
|
|
|
|
.ToPageList(parm.PageNum, parm.PageSize, ref total);
|
|
|
|
|
|
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterialQuery_stockQuantityDto> material_stockQuantity_list =
|
|
|
|
|
|
new List<WmMaterialQuery_stockQuantityDto>();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
if (materialList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (WmMaterial item in materialList)
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
WmMaterialQuery_stockQuantityDto wmMaterialQuery_Stock_item =
|
|
|
|
|
|
item.Adapt<WmMaterialQuery_stockQuantityDto>();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
int material_num = 0;
|
|
|
|
|
|
List<WmGoodsNowProduction> productioList = Context
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.Partnumber == item.Partnumber)
|
|
|
|
|
|
.ToList();
|
2024-03-19 11:08:28 +08:00
|
|
|
|
|
|
|
|
|
|
if (productioList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var product in productioList)
|
|
|
|
|
|
{
|
2024-05-10 09:02:33 +08:00
|
|
|
|
int num = product.GoodsNumAction ?? 0;
|
|
|
|
|
|
material_num += num;
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-29 17:00:38 +08:00
|
|
|
|
|
|
|
|
|
|
wmMaterialQuery_Stock_item.stockQuantity = material_num;
|
|
|
|
|
|
material_stockQuantity_list.Add(wmMaterialQuery_Stock_item);
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return (material_stockQuantity_list, total);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-22 08:54:11 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询出货单的物料信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="shipment_num"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public List<WmMaterialQuery_print> Queryoutoder_matrials(string shipment_num)
|
|
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterialQuery_print> stockList = Context
|
|
|
|
|
|
.Queryable<WmMaterialOutorder>()
|
|
|
|
|
|
.LeftJoin<WmMaterial>((mo, m) => mo.FkMaterialId == m.Id)
|
|
|
|
|
|
.Where(mo => mo.FkOutorderId == shipment_num)
|
|
|
|
|
|
.Select(
|
|
|
|
|
|
(mo, m) =>
|
|
|
|
|
|
new WmMaterialQuery_print()
|
|
|
|
|
|
{
|
|
|
|
|
|
//物料号
|
|
|
|
|
|
Partnumber = m.Partnumber,
|
|
|
|
|
|
// 描述
|
|
|
|
|
|
ProductName = m.ProductName,
|
|
|
|
|
|
//需求零件数
|
|
|
|
|
|
RequireOutNum = mo.OuthouseNum
|
|
|
|
|
|
}
|
|
|
|
|
|
)
|
|
|
|
|
|
.ToList();
|
2024-03-28 08:52:44 +08:00
|
|
|
|
|
2024-03-22 08:54:11 +08:00
|
|
|
|
if (stockList != null && stockList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var stock in stockList)
|
|
|
|
|
|
{
|
2024-04-08 11:01:42 +08:00
|
|
|
|
//库存箱数
|
2024-08-05 17:25:52 +08:00
|
|
|
|
stock.PackageNum = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.Partnumber == stock.Partnumber)
|
|
|
|
|
|
.Count();
|
2024-03-22 08:54:11 +08:00
|
|
|
|
|
2024-04-08 11:01:42 +08:00
|
|
|
|
//库存零件数
|
2024-08-05 17:25:52 +08:00
|
|
|
|
int? num = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
2024-03-28 08:52:44 +08:00
|
|
|
|
.Where(it => it.Partnumber == stock.Partnumber)
|
2024-03-28 15:36:38 +08:00
|
|
|
|
.Sum(it => it.GoodsNumAction);
|
2024-03-26 14:19:01 +08:00
|
|
|
|
stock.ItemNum = num ?? 0;
|
2024-04-08 11:01:42 +08:00
|
|
|
|
|
|
|
|
|
|
// 需求箱数
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmGoodsNowProduction> list = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.Partnumber == stock.Partnumber)
|
|
|
|
|
|
.OrderByDescending(it => it.PackageCodeClient)
|
|
|
|
|
|
.ToList();
|
2024-04-08 11:01:42 +08:00
|
|
|
|
|
|
|
|
|
|
int sum = 0;
|
|
|
|
|
|
foreach (var item in list)
|
|
|
|
|
|
{
|
2024-04-14 11:16:19 +08:00
|
|
|
|
sum = sum + item.GoodsNumLogic ?? 0;
|
|
|
|
|
|
if (sum >= stock.RequireOutNum)
|
2024-04-08 11:01:42 +08:00
|
|
|
|
{
|
2024-04-14 11:16:19 +08:00
|
|
|
|
stock.Require_pack_num = list.IndexOf(item) + 1;
|
2024-04-08 11:01:42 +08:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return stockList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-03-28 11:17:18 +08:00
|
|
|
|
/// 生成出库单的出货计划
|
2024-03-22 08:54:11 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="shipment_num">出货单号</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public List<WmOutOrderPlan> Generate_outorderplan(string shipment_num)
|
|
|
|
|
|
{
|
2024-03-28 11:17:18 +08:00
|
|
|
|
// 最终结果
|
|
|
|
|
|
List<WmOutOrderPlan> planList = new List<WmOutOrderPlan>();
|
2024-03-22 08:54:11 +08:00
|
|
|
|
// 获取当前出货单下的物料信息
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterialQuery_print> materialQuery_Prints = this.Queryoutoder_matrials(
|
|
|
|
|
|
shipment_num
|
|
|
|
|
|
);
|
2024-03-22 08:54:11 +08:00
|
|
|
|
if (materialQuery_Prints != null && materialQuery_Prints.Count > 0)
|
|
|
|
|
|
{
|
2024-03-28 11:17:18 +08:00
|
|
|
|
// 物料解析
|
2024-03-22 08:54:11 +08:00
|
|
|
|
foreach (var material in materialQuery_Prints)
|
|
|
|
|
|
{
|
2024-03-28 11:17:18 +08:00
|
|
|
|
//1. 物料需求量
|
2024-03-22 08:54:11 +08:00
|
|
|
|
int require_num = material.RequireOutNum;
|
|
|
|
|
|
// 物料号
|
|
|
|
|
|
string partnumber = material.Partnumber;
|
2024-03-28 11:17:18 +08:00
|
|
|
|
// 该物料下 ,现有货物列表,零件号相同,根据批次号从小到大排序
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmGoodsNowProduction> wmGoodsNowsList = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.Partnumber == partnumber)
|
|
|
|
|
|
.Where(it => it.LocationCode != "Z1-01")
|
|
|
|
|
|
.OrderBy(it => it.PackageCodeClient)
|
|
|
|
|
|
.ToList();
|
2024-04-14 11:16:19 +08:00
|
|
|
|
|
2024-03-28 11:17:18 +08:00
|
|
|
|
// 判断要出多少批次的货
|
|
|
|
|
|
List<WmOutOrderPlan> wmOutOrderPlans = new List<WmOutOrderPlan>();
|
2024-03-28 15:36:38 +08:00
|
|
|
|
// 当前累计批次货物总数
|
|
|
|
|
|
int accumulation_num = 0;
|
2024-03-23 14:31:50 +08:00
|
|
|
|
foreach (var witem in wmGoodsNowsList)
|
2024-03-22 08:54:11 +08:00
|
|
|
|
{
|
2024-10-25 19:01:06 +08:00
|
|
|
|
//TODO 修改>= 为 > 查看情况
|
|
|
|
|
|
if (require_num > accumulation_num)
|
2024-03-22 08:54:11 +08:00
|
|
|
|
{
|
|
|
|
|
|
WmOutOrderPlan orderPlan = new WmOutOrderPlan();
|
|
|
|
|
|
orderPlan.FkOutOrderId = shipment_num;
|
|
|
|
|
|
orderPlan.Patchcode = witem.PackageCodeClient;
|
2024-03-28 11:17:18 +08:00
|
|
|
|
orderPlan.Patchcode_short = witem.PackageCodeClient.Split("_")[0];
|
2024-03-22 08:54:11 +08:00
|
|
|
|
orderPlan.MaterialCode = witem.Partnumber;
|
|
|
|
|
|
orderPlan.WarehouseCode = witem.LocationCode;
|
2024-03-28 11:17:18 +08:00
|
|
|
|
orderPlan.PackageNum = material.PackageNum;
|
2024-03-28 15:36:38 +08:00
|
|
|
|
// 获得批次的总零件数
|
2024-04-09 14:03:10 +08:00
|
|
|
|
orderPlan.PartnumberNum = witem.GoodsNumLogic;
|
2024-03-22 08:54:11 +08:00
|
|
|
|
orderPlan.RequireNum = require_num;
|
2024-04-14 11:16:19 +08:00
|
|
|
|
orderPlan.ReceivedPackNum = 0;
|
2024-03-28 11:17:18 +08:00
|
|
|
|
orderPlan.Patchtime = Resolution_bath(witem.PackageCodeOriginal);
|
2024-03-22 08:54:11 +08:00
|
|
|
|
wmOutOrderPlans.Add(orderPlan);
|
2024-03-26 14:19:01 +08:00
|
|
|
|
// 实际值计算
|
2024-04-09 14:03:10 +08:00
|
|
|
|
accumulation_num = accumulation_num + witem.GoodsNumLogic ?? 0;
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-28 11:17:18 +08:00
|
|
|
|
// 进行聚合
|
2024-03-26 14:19:01 +08:00
|
|
|
|
if (wmOutOrderPlans.Count > 0)
|
2024-03-28 11:17:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
// 根据批次号下划线前进行聚合
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmOutOrderPlan> material_plan_item = wmOutOrderPlans
|
|
|
|
|
|
.GroupBy(it => it.Patchcode_short)
|
|
|
|
|
|
.Select(g => new WmOutOrderPlan
|
|
|
|
|
|
{
|
|
|
|
|
|
FkOutOrderId = g.Max(p => p.FkOutOrderId),
|
|
|
|
|
|
Patchcode = g.Max(p => p.Patchcode_short),
|
|
|
|
|
|
Patchcode_short = g.Max(p => p.Patchcode_short),
|
|
|
|
|
|
WarehouseCode = g.Max(p => p.WarehouseCode),
|
|
|
|
|
|
MaterialCode = g.Max(p => p.MaterialCode),
|
|
|
|
|
|
PackageNum = g.Count(),
|
|
|
|
|
|
PartnumberNum = g.Sum(p => p.PartnumberNum),
|
|
|
|
|
|
RequireNum = g.Max(p => p.RequireNum),
|
|
|
|
|
|
ReceivedPackNum = 0,
|
|
|
|
|
|
Patchtime = g.Max(p => p.Patchtime),
|
|
|
|
|
|
})
|
|
|
|
|
|
.ToList();
|
2024-04-09 14:03:10 +08:00
|
|
|
|
|
2024-04-14 11:16:19 +08:00
|
|
|
|
planList = planList.Concat(material_plan_item).ToList();
|
2024-03-28 11:17:18 +08:00
|
|
|
|
}
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-28 11:17:18 +08:00
|
|
|
|
// 添加序号
|
|
|
|
|
|
int count = 1;
|
|
|
|
|
|
foreach (var witem in planList)
|
2024-03-22 08:54:11 +08:00
|
|
|
|
{
|
2024-03-28 11:17:18 +08:00
|
|
|
|
witem.Id = count;
|
|
|
|
|
|
witem.Outorder = count;
|
2024-04-14 11:16:19 +08:00
|
|
|
|
|
2024-03-28 11:17:18 +08:00
|
|
|
|
count++;
|
2024-08-05 17:25:52 +08:00
|
|
|
|
witem.Inventory_pack_num = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
2024-04-14 11:16:19 +08:00
|
|
|
|
.Where(it => it.PackageCodeClient.Contains(witem.Patchcode))
|
2024-04-08 11:01:42 +08:00
|
|
|
|
.Count();
|
2024-08-05 17:25:52 +08:00
|
|
|
|
witem.Inventory_num =
|
|
|
|
|
|
Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient.Contains(witem.Patchcode))
|
|
|
|
|
|
.Sum(it => it.GoodsNumLogic) ?? 0;
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-28 11:17:18 +08:00
|
|
|
|
return planList;
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-23 14:31:50 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 根据出库单号与货物批次号,向出库记录添加数据,并且成品库表数据删除
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="doMaterialOut"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-03-26 14:19:01 +08:00
|
|
|
|
public (int, int) DoMaterialOut(WmDoMaterialOut_Dto doMaterialOut, string Createby)
|
2024-03-23 14:31:50 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
try
|
2024-03-23 14:31:50 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
Context.Ado.BeginTran();
|
|
|
|
|
|
List<string> deleteList = new();
|
|
|
|
|
|
List<WmGoodsOutRecord> insertList = new();
|
|
|
|
|
|
string shipnumber = doMaterialOut.ShipmentNum;
|
|
|
|
|
|
if (doMaterialOut.PatchCode == null || doMaterialOut.PatchCode.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Context.Ado.RollbackTran();
|
|
|
|
|
|
throw new Exception("批次号列表为空,不可出库" + doMaterialOut.PatchCode);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 统计记录
|
|
|
|
|
|
List<string> partnumbers = new();
|
|
|
|
|
|
int totalPackage = 0;
|
|
|
|
|
|
int totalPartnumber = 0;
|
|
|
|
|
|
List<string> packageCodeRemark = new();
|
2024-03-26 14:19:01 +08:00
|
|
|
|
foreach (var item in doMaterialOut.PatchCode)
|
2024-03-23 14:31:50 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
Context
|
|
|
|
|
|
.Updateable<WmOutOrderPlan>()
|
|
|
|
|
|
.SetColumns(it => it.ReceivedPackNum == it.ReceivedPackNum + 1)
|
2024-04-14 11:16:19 +08:00
|
|
|
|
.Where(it => it.FkOutOrderId == shipnumber)
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.Where(it => it.Patchcode == item)
|
|
|
|
|
|
.ExecuteCommand();
|
|
|
|
|
|
WmGoodsOutRecord record =
|
|
|
|
|
|
new() { Id = SnowFlakeSingle.Instance.NextId().ToString() };
|
|
|
|
|
|
WmGoodsNowProduction nowProduction = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient == item)
|
2024-04-15 11:36:08 +08:00
|
|
|
|
.First();
|
2024-08-05 17:25:52 +08:00
|
|
|
|
if (nowProduction == null)
|
2024-04-15 13:11:51 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
Context.Ado.RollbackTran();
|
|
|
|
|
|
throw new Exception("成品仓库未查到此货物,无法出库!" + item);
|
2024-04-14 11:16:19 +08:00
|
|
|
|
}
|
2024-08-05 17:25:52 +08:00
|
|
|
|
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;
|
|
|
|
|
|
insertList.Add(record);
|
|
|
|
|
|
deleteList.Add(nowProduction.Id);
|
|
|
|
|
|
// 记录统计
|
|
|
|
|
|
totalPackage++;
|
|
|
|
|
|
if (!partnumbers.Contains(nowProduction.Partnumber))
|
|
|
|
|
|
{
|
|
|
|
|
|
partnumbers.Add(nowProduction.Partnumber);
|
|
|
|
|
|
}
|
|
|
|
|
|
totalPartnumber += nowProduction.GoodsNumAction ?? 0;
|
|
|
|
|
|
packageCodeRemark.Add(nowProduction.PackageCodeClient);
|
|
|
|
|
|
}
|
|
|
|
|
|
int sum_insert = Context.Insertable(insertList).ExecuteCommand();
|
|
|
|
|
|
int sum_delete = Context
|
|
|
|
|
|
.Deleteable<WmGoodsNowProduction>()
|
|
|
|
|
|
.In(deleteList.ToArray())
|
|
|
|
|
|
.ExecuteCommand();
|
|
|
|
|
|
if (sum_insert != sum_delete)
|
|
|
|
|
|
{
|
|
|
|
|
|
Context.Ado.RollbackTran();
|
|
|
|
|
|
throw new Exception(
|
|
|
|
|
|
"出库操作出现异常!失败原因记录不一致:添加数据" + sum_insert + "删除数据:" + sum_delete
|
|
|
|
|
|
);
|
2024-03-23 14:31:50 +08:00
|
|
|
|
}
|
2024-08-05 17:25:52 +08:00
|
|
|
|
packageCodeRemark.Sort();
|
|
|
|
|
|
// 插入记录
|
|
|
|
|
|
WmGoodsRecord wmGoodsRecord =
|
|
|
|
|
|
new()
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
|
|
|
|
|
FkInventoryId = SnowFlakeSingle.Instance.NextId().ToString(),
|
2024-08-06 13:16:22 +08:00
|
|
|
|
Code = "DoMaterialOut",
|
|
|
|
|
|
Partnumber = partnumbers[0] ?? "无零件号",
|
2024-08-05 17:25:52 +08:00
|
|
|
|
BlankNum = "",
|
|
|
|
|
|
ChangeType = 2,
|
2025-08-15 14:58:32 +08:00
|
|
|
|
ChangePackage = totalPackage,
|
2024-08-05 17:25:52 +08:00
|
|
|
|
ChangeQuantity = totalPartnumber,
|
|
|
|
|
|
ActionTime = DateTime.Now,
|
|
|
|
|
|
Status = 1,
|
|
|
|
|
|
Remark =
|
2024-08-06 13:16:22 +08:00
|
|
|
|
"货物出库"
|
2024-08-05 17:25:52 +08:00
|
|
|
|
+ "\n出库单:"
|
|
|
|
|
|
+ shipnumber
|
2024-08-06 13:16:22 +08:00
|
|
|
|
+ "\n零件号:"
|
|
|
|
|
|
+ string.Join(',', partnumbers)
|
2024-08-16 16:05:17 +08:00
|
|
|
|
+ "\n数据库变动:插入成功"
|
|
|
|
|
|
+ sum_insert
|
|
|
|
|
|
+ "删除成功"
|
|
|
|
|
|
+ sum_delete
|
2024-08-05 17:25:52 +08:00
|
|
|
|
+ "\n总箱数:"
|
|
|
|
|
|
+ totalPackage
|
|
|
|
|
|
+ "\n总零件数:"
|
|
|
|
|
|
+ totalPartnumber
|
|
|
|
|
|
+ "\n涉及批次号:\n"
|
|
|
|
|
|
+ string.Join(',', packageCodeRemark),
|
2024-08-16 16:05:17 +08:00
|
|
|
|
|
2025-08-15 14:58:32 +08:00
|
|
|
|
CreatedBy = Createby ?? "系统操作",
|
2024-08-05 17:25:52 +08:00
|
|
|
|
CreatedTime = DateTime.Now,
|
|
|
|
|
|
};
|
|
|
|
|
|
int recordNum = Context.Insertable(wmGoodsRecord).ExecuteCommand();
|
|
|
|
|
|
if (recordNum == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Context.Ado.RollbackTran();
|
|
|
|
|
|
throw new Exception("记录插入失败");
|
|
|
|
|
|
}
|
2025-06-09 18:14:52 +08:00
|
|
|
|
// 出库信息转发U8
|
|
|
|
|
|
|
|
|
|
|
|
//1.构建信息
|
2025-07-22 16:39:51 +08:00
|
|
|
|
// TODO 客户编号获取
|
|
|
|
|
|
string _outOrder = shipnumber ?? "无出库单";
|
|
|
|
|
|
|
|
|
|
|
|
string _customerCode =
|
|
|
|
|
|
Context
|
|
|
|
|
|
.Queryable<WmOutOrder>()
|
|
|
|
|
|
.Where(x => x.ShipmentNum == _outOrder)
|
|
|
|
|
|
.Select(x => x.CustomNo)
|
|
|
|
|
|
.First() ?? "无客户代码";
|
2025-06-09 18:14:52 +08:00
|
|
|
|
List<ERP_WMS_interactiveModelQuery> u8PackageList = new();
|
|
|
|
|
|
foreach (var item in insertList)
|
|
|
|
|
|
{
|
|
|
|
|
|
string dateString = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
|
// 使用正则表达式匹配日期模式
|
|
|
|
|
|
string pattern = @"(\d{2})(\d{2})(\d{2})";
|
|
|
|
|
|
Match match = Regex.Match(item.PackageCodeClient, pattern);
|
|
|
|
|
|
|
|
|
|
|
|
if (match.Success)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 提取匹配的年份、月份和日期
|
|
|
|
|
|
string year = match.Groups[1].Value;
|
|
|
|
|
|
string month = match.Groups[2].Value;
|
|
|
|
|
|
string day = match.Groups[3].Value;
|
|
|
|
|
|
// 转换为四位数年份(假设2000年代)
|
|
|
|
|
|
string fullYear = "20" + year;
|
|
|
|
|
|
// 组合为yyyyMMdd格式
|
|
|
|
|
|
dateString = fullYear + month + day;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
logger.Warn($"未找到匹配的日期模式:{item.PackageCodeClient}");
|
|
|
|
|
|
}
|
|
|
|
|
|
ERP_WMS_interactiveModelQuery u8PackageItem =
|
|
|
|
|
|
new()
|
|
|
|
|
|
{
|
2025-07-22 16:39:51 +08:00
|
|
|
|
customerCode = _customerCode,
|
2025-06-09 18:14:52 +08:00
|
|
|
|
materialCode = item.Partnumber,
|
|
|
|
|
|
location = item.LocationCode,
|
|
|
|
|
|
Qty = item.GoodsNumLogic.ToString(),
|
|
|
|
|
|
// 批次号
|
|
|
|
|
|
LotNo = dateString,
|
|
|
|
|
|
createTime = DateTime.Now,
|
|
|
|
|
|
userID = Createby,
|
|
|
|
|
|
guid = Guid.NewGuid().ToString(),
|
|
|
|
|
|
lineno = "涂装生产线"
|
|
|
|
|
|
};
|
|
|
|
|
|
u8PackageList.Add(u8PackageItem);
|
|
|
|
|
|
}
|
2025-07-17 16:05:55 +08:00
|
|
|
|
string urlBase = "http://gam.com.cn:8053/";
|
2025-06-09 18:14:52 +08:00
|
|
|
|
ERP_WMS_interactiveService _eRP_WMS_InteractiveService = new();
|
2025-06-22 09:19:56 +08:00
|
|
|
|
// 后台执行不阻塞主线程
|
2025-07-28 15:40:59 +08:00
|
|
|
|
_ = Task.Run(async () =>
|
|
|
|
|
|
{
|
2025-06-22 09:19:56 +08:00
|
|
|
|
var u8ErpResult = await _eRP_WMS_InteractiveService.OutboundedAsync(urlBase, u8PackageList);
|
|
|
|
|
|
// 处理结果...
|
|
|
|
|
|
//TODO 对U8返回结果进行解析
|
|
|
|
|
|
logger.Warn(u8ErpResult);
|
|
|
|
|
|
});
|
|
|
|
|
|
/*
|
|
|
|
|
|
*ERP_WMS_interactiveModelResult u8ErpResult = _eRP_WMS_InteractiveService.Outbounded(
|
|
|
|
|
|
urlBase,
|
|
|
|
|
|
u8PackageList
|
|
|
|
|
|
);
|
|
|
|
|
|
logger.Warn(u8ErpResult);*/
|
2024-08-05 17:25:52 +08:00
|
|
|
|
Context.Ado.CommitTran();
|
|
|
|
|
|
return (sum_delete, sum_insert);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Context.Ado.RollbackTran();
|
|
|
|
|
|
throw new Exception(e.Message);
|
2024-03-23 14:31:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-26 14:19:01 +08:00
|
|
|
|
public bool OverOutorderplan(string shipment_num)
|
2024-03-23 14:31:50 +08:00
|
|
|
|
{
|
2024-08-05 17:25:52 +08:00
|
|
|
|
int reult = Context
|
|
|
|
|
|
.Updateable<WmOutOrder>()
|
|
|
|
|
|
.Where(it => it.ShipmentNum == shipment_num)
|
|
|
|
|
|
.SetColumns(it => it.Type == 2)
|
|
|
|
|
|
.ExecuteCommand();
|
2024-03-26 14:19:01 +08:00
|
|
|
|
if (reult > 0)
|
2024-03-23 14:31:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-22 08:54:11 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 传入批次号 解析出时间 BNW240318007_105
|
|
|
|
|
|
/// </summary>
|
2024-03-28 11:17:18 +08:00
|
|
|
|
/// <param name="production_packcode">原始编码</param>
|
2024-03-22 08:54:11 +08:00
|
|
|
|
/// <returns></returns>
|
2024-03-28 11:17:18 +08:00
|
|
|
|
private string Resolution_bath(string production_packcode)
|
2024-03-22 08:54:11 +08:00
|
|
|
|
{
|
2024-03-28 11:17:18 +08:00
|
|
|
|
MaterialUtils materialToos = new MaterialUtils();
|
2024-08-05 17:25:52 +08:00
|
|
|
|
ResultionPackageCodeDto resultionPackage = materialToos.ResolutionPackage(
|
|
|
|
|
|
production_packcode
|
|
|
|
|
|
);
|
2024-03-28 11:17:18 +08:00
|
|
|
|
if (resultionPackage == null)
|
2024-03-22 08:54:11 +08:00
|
|
|
|
{
|
2024-03-28 11:17:18 +08:00
|
|
|
|
return "时间解析异常";
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
2024-03-28 11:17:18 +08:00
|
|
|
|
return resultionPackage.ProductionTime;
|
2024-03-22 08:54:11 +08:00
|
|
|
|
}
|
2024-08-05 17:25:52 +08:00
|
|
|
|
|
2024-04-25 17:35:01 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 8.5 PDA端 获取出库单的持久化存储出库计划并计算计划批次当前已出库数量
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="shipment_num">出库单号</param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-08-05 17:25:52 +08:00
|
|
|
|
public List<WmOutPlanAndGoodsOutProductionNumDto> GetOutOrderPlanAndOutProductionNum(
|
|
|
|
|
|
string shipment_num,
|
|
|
|
|
|
string partnumber
|
|
|
|
|
|
)
|
2024-04-25 17:35:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
List<WmOutPlanAndGoodsOutProductionNumDto> result = new();
|
|
|
|
|
|
// 当前工单出库计划
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var exp = Expressionable
|
|
|
|
|
|
.Create<WmOutOrderPlan>()
|
|
|
|
|
|
.And(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.AndIF(!string.IsNullOrEmpty(partnumber), it => it.MaterialCode == partnumber)
|
|
|
|
|
|
.ToExpression();
|
|
|
|
|
|
List<WmOutOrderPlan> wmOutOrderPlan = Context
|
|
|
|
|
|
.Queryable<WmOutOrderPlan>()
|
|
|
|
|
|
.Where(exp)
|
|
|
|
|
|
.OrderBy(it => it.Outorder)
|
|
|
|
|
|
.ToList();
|
2024-04-25 17:35:01 +08:00
|
|
|
|
// 查询每个计划具体出库数据
|
|
|
|
|
|
foreach (WmOutOrderPlan item in wmOutOrderPlan)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 库存记录
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmGoodsNowProduction> nowProductionList = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient.Contains(item.Patchcode))
|
|
|
|
|
|
.ToList();
|
2024-04-25 17:35:01 +08:00
|
|
|
|
int nowPackageNum = 0;
|
|
|
|
|
|
int nowPartnumberNum = 0;
|
|
|
|
|
|
foreach (WmGoodsNowProduction outItem in nowProductionList)
|
|
|
|
|
|
{
|
|
|
|
|
|
nowPackageNum += 1;
|
|
|
|
|
|
nowPartnumberNum += (int)outItem.GoodsNumAction;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 出库记录
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmGoodsOutRecord> outPackageList = Context
|
|
|
|
|
|
.Queryable<WmGoodsOutRecord>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient.Contains(item.Patchcode))
|
|
|
|
|
|
.Where(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.ToList();
|
2024-04-25 17:35:01 +08:00
|
|
|
|
int outPackageNum = 0;
|
|
|
|
|
|
int outPartnumberNum = 0;
|
|
|
|
|
|
foreach (WmGoodsOutRecord outItem in outPackageList)
|
|
|
|
|
|
{
|
|
|
|
|
|
outPackageNum += 1;
|
|
|
|
|
|
outPartnumberNum += (int)outItem.GoodsNumAction;
|
|
|
|
|
|
}
|
2024-08-05 17:25:52 +08:00
|
|
|
|
WmMaterial material = Context
|
|
|
|
|
|
.Queryable<WmMaterial>()
|
|
|
|
|
|
.Where(it => it.Partnumber.Contains(item.MaterialCode))
|
|
|
|
|
|
.First();
|
|
|
|
|
|
WmOutPlanAndGoodsOutProductionNumDto newItem =
|
|
|
|
|
|
new()
|
|
|
|
|
|
{
|
|
|
|
|
|
OutOrder = (int)item.Outorder,
|
|
|
|
|
|
PackageCode = item.Patchcode,
|
|
|
|
|
|
Partnumber = item.MaterialCode,
|
|
|
|
|
|
Description = !string.IsNullOrEmpty(material.Description)
|
|
|
|
|
|
? material.Description
|
|
|
|
|
|
: material.ProductName,
|
|
|
|
|
|
WarehouseCode = item.WarehouseCode,
|
|
|
|
|
|
RequireNum = (int)item.RequireNum,
|
|
|
|
|
|
PackageNum = (int)nowPackageNum,
|
|
|
|
|
|
PartnumberNum = (int)nowPartnumberNum,
|
|
|
|
|
|
PackagePlanNum = (int)item.PackageNum,
|
|
|
|
|
|
PartnumberPlanNum = (int)item.PartnumberNum,
|
|
|
|
|
|
OutPackageNum = outPackageNum,
|
|
|
|
|
|
OutPartnumberNum = outPartnumberNum,
|
|
|
|
|
|
IsError = (nowPartnumberNum + outPartnumberNum) != item.PartnumberNum,
|
|
|
|
|
|
IsOver = outPartnumberNum > item.PartnumberNum
|
|
|
|
|
|
};
|
2024-04-25 17:35:01 +08:00
|
|
|
|
result.Add(newItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2025-06-02 09:15:26 +08:00
|
|
|
|
catch (Exception)
|
2024-04-25 17:35:01 +08:00
|
|
|
|
{
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-03-28 09:12:17 +08:00
|
|
|
|
|
2024-03-28 11:17:18 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 检查是否可出库
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="production_packcode"></param>
|
|
|
|
|
|
/// <param name="shipment_num"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-08-05 17:25:52 +08:00
|
|
|
|
public string CheckProductionOut(
|
|
|
|
|
|
string parnumber,
|
|
|
|
|
|
string production_packcode,
|
|
|
|
|
|
string shipment_num
|
|
|
|
|
|
)
|
2024-03-28 09:12:17 +08:00
|
|
|
|
{
|
2024-03-28 12:29:39 +08:00
|
|
|
|
try
|
2024-03-28 11:17:18 +08:00
|
|
|
|
{
|
2024-03-28 12:29:39 +08:00
|
|
|
|
if (shipment_num == "" || production_packcode == "")
|
|
|
|
|
|
{
|
|
|
|
|
|
return "传入数据为空!请检查参数";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 1.判断工单是否处于已完成状态
|
2024-08-05 17:25:52 +08:00
|
|
|
|
bool isOutOrderCanUse = Context
|
|
|
|
|
|
.Queryable<WmOutOrder>()
|
|
|
|
|
|
.Where(it => it.ShipmentNum == shipment_num)
|
|
|
|
|
|
.Where(it => it.Type == 1)
|
|
|
|
|
|
.Any();
|
2024-03-28 12:29:39 +08:00
|
|
|
|
if (!isOutOrderCanUse)
|
2024-03-28 11:17:18 +08:00
|
|
|
|
{
|
2024-03-28 12:29:39 +08:00
|
|
|
|
return "出库单已完成或已弃用!请检查出库单";
|
2024-03-28 11:17:18 +08:00
|
|
|
|
}
|
2024-03-28 12:29:39 +08:00
|
|
|
|
|
|
|
|
|
|
MaterialUtils materialToos = new MaterialUtils();
|
|
|
|
|
|
// 2.解析标签编码
|
2024-08-05 17:25:52 +08:00
|
|
|
|
ResultionPackageCodeDto resultionPackage = materialToos.ResolutionPackage(
|
|
|
|
|
|
production_packcode
|
|
|
|
|
|
);
|
2024-03-28 12:29:39 +08:00
|
|
|
|
if (resultionPackage == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "标签解析异常!请检查标签";
|
|
|
|
|
|
}
|
2024-04-14 11:16:19 +08:00
|
|
|
|
//3 判断箱子是否配置零件号
|
2025-06-02 09:15:26 +08:00
|
|
|
|
string checkPartnumber = resultionPackage.PartNumner;
|
|
|
|
|
|
// 使用正则表达式匹配并移除特殊后缀
|
|
|
|
|
|
string processedPartnumber = Regex.Replace(
|
|
|
|
|
|
checkPartnumber,
|
|
|
|
|
|
@"-(FL|FR|RR|RL)$",
|
|
|
|
|
|
"",
|
|
|
|
|
|
RegexOptions.IgnoreCase
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (parnumber != processedPartnumber)
|
2024-03-28 12:29:39 +08:00
|
|
|
|
{
|
2024-04-29 17:00:38 +08:00
|
|
|
|
return "此箱子不是选择的物料号";
|
2024-03-28 12:29:39 +08:00
|
|
|
|
}
|
2024-04-09 14:03:10 +08:00
|
|
|
|
|
2024-04-24 16:44:01 +08:00
|
|
|
|
// 3.1判断是否已入库
|
2024-08-05 17:25:52 +08:00
|
|
|
|
bool isExistedWarehouse = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient == resultionPackage.PatchCode)
|
|
|
|
|
|
.Any();
|
2024-04-24 16:44:01 +08:00
|
|
|
|
if (!isExistedWarehouse)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "该箱号未入库!请先入库";
|
|
|
|
|
|
}
|
2024-05-06 16:04:11 +08:00
|
|
|
|
// 3.2 判断是否是计划中的物料(大概率不执行)
|
|
|
|
|
|
bool flag1 = false;
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmMaterial> materialOutorders = Context
|
|
|
|
|
|
.Queryable<WmMaterialOutorder>()
|
2024-05-14 10:31:24 +08:00
|
|
|
|
.LeftJoin<WmMaterial>((wmo, wm) => wmo.FkMaterialId == wm.Id)
|
2024-05-06 16:04:11 +08:00
|
|
|
|
.Where(wmo => wmo.FkOutorderId == shipment_num)
|
2024-08-05 17:25:52 +08:00
|
|
|
|
.Select((wmo, wm) => new WmMaterial { Partnumber = wm.Partnumber })
|
2024-05-06 16:04:11 +08:00
|
|
|
|
.ToList();
|
2024-05-14 10:31:24 +08:00
|
|
|
|
foreach (WmMaterial materialOption in materialOutorders)
|
2024-05-06 16:04:11 +08:00
|
|
|
|
{
|
2025-08-08 16:04:25 +08:00
|
|
|
|
if (materialOption.Partnumber == processedPartnumber || materialOption.Partnumber == checkPartnumber)
|
2024-05-06 16:04:11 +08:00
|
|
|
|
{
|
|
|
|
|
|
flag1 = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!flag1)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "该箱标签物料号不在出库单物料清单内!";
|
|
|
|
|
|
}
|
|
|
|
|
|
// 4. 判断出库单是否启用出库规则
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var shipment = Context
|
|
|
|
|
|
.Queryable<WmOutOrder>()
|
|
|
|
|
|
.Where(it => it.ShipmentNum == shipment_num)
|
|
|
|
|
|
.First();
|
2024-05-06 16:04:11 +08:00
|
|
|
|
if (shipment.Status == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "ok";
|
|
|
|
|
|
}
|
2024-04-15 13:11:51 +08:00
|
|
|
|
// 5. 确保出最早批次
|
|
|
|
|
|
string short_path = resultionPackage.PatchCode.Split('_')[0];
|
2024-05-06 16:04:11 +08:00
|
|
|
|
// 严格规则(出库规则判断)
|
2024-04-30 14:18:00 +08:00
|
|
|
|
return CheckRuleJudgmentFirstInFirstOut(shipment_num, short_path, parnumber);
|
2024-04-29 17:00:38 +08:00
|
|
|
|
/*WmOutOrderPlan plan_item = Context.Queryable<WmOutOrderPlan>()
|
2024-04-15 13:11:51 +08:00
|
|
|
|
.Where(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.Where(it => it.Patchcode == short_path)
|
|
|
|
|
|
.OrderBy(it => it.Outorder)
|
|
|
|
|
|
.First();
|
|
|
|
|
|
|
|
|
|
|
|
if (plan_item != null)
|
2024-03-28 12:29:39 +08:00
|
|
|
|
{
|
2024-04-29 17:00:38 +08:00
|
|
|
|
// 查看此批次号在此工单下已出库箱子数量
|
|
|
|
|
|
int patchInNum = Context.Queryable<WmGoodsOutRecord>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient.Contains(short_path))
|
|
|
|
|
|
.Where(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.Count();
|
2024-04-15 13:11:51 +08:00
|
|
|
|
var plan_earliest = Context.Queryable<WmOutOrderPlan>()
|
|
|
|
|
|
.Where(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.Where(it => it.MaterialCode == plan_item.MaterialCode)
|
2024-04-29 17:00:38 +08:00
|
|
|
|
.Where(it => it.PackageNum > patchInNum)
|
2024-04-15 13:11:51 +08:00
|
|
|
|
.OrderBy(it => it.Outorder)
|
|
|
|
|
|
.First();
|
|
|
|
|
|
//已经出库完成,没有可以出库的了
|
|
|
|
|
|
if (plan_earliest == null)
|
|
|
|
|
|
{
|
2024-04-29 17:00:38 +08:00
|
|
|
|
return "此物料在计划中已经全部出库完成,无法继续出库";
|
2024-04-15 13:11:51 +08:00
|
|
|
|
}
|
2024-04-29 17:00:38 +08:00
|
|
|
|
// 批次号是最早批次
|
2024-08-05 17:25:52 +08:00
|
|
|
|
*/
|
|
|
|
|
|
/*if (plan_earliest.Id == plan_item.Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "ok";
|
|
|
|
|
|
}*/
|
|
|
|
|
|
/*
|
|
|
|
|
|
if (plan_earliest.Patchcode == short_path)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "ok";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return "不是此物料最早批次,无法出库";
|
|
|
|
|
|
}
|
|
|
|
|
|
}*/
|
2024-04-09 14:03:10 +08:00
|
|
|
|
// 6 .还差一个 数量超过要出库的箱子
|
2024-03-28 12:29:39 +08:00
|
|
|
|
return "此箱标签不可出库,批次号不在出库单计划内!请检查出库单计划!";
|
|
|
|
|
|
}
|
2025-06-02 09:15:26 +08:00
|
|
|
|
catch (Exception)
|
2024-03-28 12:29:39 +08:00
|
|
|
|
{
|
|
|
|
|
|
return "此箱标签存在异常不可出库!";
|
2024-03-28 11:17:18 +08:00
|
|
|
|
}
|
2024-03-28 09:12:17 +08:00
|
|
|
|
}
|
2024-04-11 16:23:11 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 持久化存储
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="shipment_num"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
|
public int PersistenceOutorderplan(string shipment_num)
|
|
|
|
|
|
{
|
2024-04-14 11:16:19 +08:00
|
|
|
|
List<WmOutOrderPlan> orderPlans = Generate_outorderplan(shipment_num);
|
|
|
|
|
|
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var x = Context
|
|
|
|
|
|
.Storageable(orderPlans)
|
|
|
|
|
|
.WhereColumns(it => it.FkOutOrderId)
|
|
|
|
|
|
.WhereColumns(it => it.MaterialCode)
|
|
|
|
|
|
.WhereColumns(it => it.Patchcode)
|
|
|
|
|
|
.ToStorage();
|
2024-04-14 11:16:19 +08:00
|
|
|
|
int result = x.AsInsertable.ExecuteCommand(); //执行插入
|
|
|
|
|
|
x.AsUpdateable.ExecuteCommand(); //执行更新
|
|
|
|
|
|
return result;
|
2024-04-11 16:23:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-04-29 17:00:38 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 出库单先进先出规则判断(严格复杂版)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="shipment_num">工单号</param>
|
|
|
|
|
|
/// <param name="shortPackageCode">短批次号</param>
|
|
|
|
|
|
/// <returns> "ok" 代表通过,其余返回错误提示</returns>
|
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
2024-08-05 17:25:52 +08:00
|
|
|
|
public string CheckRuleJudgmentFirstInFirstOut(
|
|
|
|
|
|
string shipment_num,
|
|
|
|
|
|
string shortPackageCode,
|
|
|
|
|
|
string parnumber
|
|
|
|
|
|
)
|
2024-04-29 17:00:38 +08:00
|
|
|
|
{
|
|
|
|
|
|
// 1.检查是否有记录
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var exp1 = Expressionable
|
|
|
|
|
|
.Create<WmOutOrderPlan>()
|
2024-04-29 17:00:38 +08:00
|
|
|
|
.And(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.And(it => it.Patchcode == shortPackageCode)
|
|
|
|
|
|
.ToExpression();
|
2024-08-05 17:25:52 +08:00
|
|
|
|
bool hasRecord = Context.Queryable<WmOutOrderPlan>().Where(exp1).Any();
|
2024-04-29 17:00:38 +08:00
|
|
|
|
if (!hasRecord)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "此批次号不在出库单计划中!";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 1.取出出库单计划
|
2024-08-05 17:25:52 +08:00
|
|
|
|
List<WmOutOrderPlan> plans = Context
|
|
|
|
|
|
.Queryable<WmOutOrderPlan>()
|
|
|
|
|
|
.Where(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.OrderBy(it => it.Outorder)
|
|
|
|
|
|
.ToList();
|
2024-04-29 17:00:38 +08:00
|
|
|
|
foreach (WmOutOrderPlan plan in plans)
|
|
|
|
|
|
{
|
2024-04-30 13:22:56 +08:00
|
|
|
|
// 不是同零件号的跳过
|
|
|
|
|
|
if (plan.MaterialCode != parnumber)
|
|
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-04-29 17:00:38 +08:00
|
|
|
|
// 2.此出库单下的批次号的已出库记录
|
2024-08-05 17:25:52 +08:00
|
|
|
|
var exp2 = Expressionable
|
|
|
|
|
|
.Create<WmGoodsOutRecord>()
|
|
|
|
|
|
.And(it => it.PackageCodeClient.Contains(plan.Patchcode))
|
|
|
|
|
|
.And(it => it.Partnumber == plan.MaterialCode)
|
|
|
|
|
|
.And(it => it.FkOutOrderId == shipment_num)
|
|
|
|
|
|
.ToExpression();
|
|
|
|
|
|
List<WmGoodsOutRecord> outPackageList = Context
|
|
|
|
|
|
.Queryable<WmGoodsOutRecord>()
|
|
|
|
|
|
.Where(exp2)
|
|
|
|
|
|
.ToList();
|
2024-04-29 17:00:38 +08:00
|
|
|
|
int outPackageNum = 0;
|
|
|
|
|
|
int outPartnumberNum = 0;
|
|
|
|
|
|
foreach (WmGoodsOutRecord outItem in outPackageList)
|
|
|
|
|
|
{
|
|
|
|
|
|
outPackageNum += 1;
|
|
|
|
|
|
outPartnumberNum += (int)outItem.GoodsNumAction;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 按顺序检查是否出完
|
|
|
|
|
|
if (plan.Patchcode != shortPackageCode)
|
|
|
|
|
|
{
|
2024-05-07 11:42:53 +08:00
|
|
|
|
// 此批次是否还有库存
|
2024-08-05 17:25:52 +08:00
|
|
|
|
bool hasAny = Context
|
|
|
|
|
|
.Queryable<WmGoodsNowProduction>()
|
|
|
|
|
|
.Where(it => it.PackageCodeClient.Contains(plan.Patchcode))
|
|
|
|
|
|
.Where(it => it.Partnumber == plan.MaterialCode)
|
|
|
|
|
|
.Any();
|
2024-04-29 17:00:38 +08:00
|
|
|
|
// 检查此批次是否出完
|
2024-05-07 11:42:53 +08:00
|
|
|
|
if (outPartnumberNum >= plan.RequireNum || !hasAny)
|
2024-04-29 17:00:38 +08:00
|
|
|
|
{
|
2024-05-07 11:42:53 +08:00
|
|
|
|
// 出完了或仓库里没了
|
2024-04-29 17:00:38 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return "不是出库单计划中此物料的最早批次,无法出库! 计划中批次:" + plan.Patchcode + "未出完!";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// 检查此批次是否出完
|
|
|
|
|
|
if (outPartnumberNum < plan.RequireNum)
|
|
|
|
|
|
{
|
|
|
|
|
|
return "ok";
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// 出完了
|
|
|
|
|
|
return "此批次已在出库计划中出完! 当前已出库:" + outPartnumberNum + "个零件!";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return "经检查,此批次号不在出库单计划中!";
|
|
|
|
|
|
}
|
2024-03-19 11:08:28 +08:00
|
|
|
|
}
|
2024-08-05 17:25:52 +08:00
|
|
|
|
}
|