入库模块init
This commit is contained in:
@@ -6,6 +6,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
@@ -16,6 +17,18 @@ namespace ZR.Service.mes.wms.IService
|
||||
// 获取库位列表
|
||||
public bool IsProductionLoacation(string production_location_code);
|
||||
|
||||
// 判断是否为成品箱子码
|
||||
public int isProductionPackage(string production_packcode);
|
||||
|
||||
//判断箱子是否满
|
||||
public bool isFullPackage(string production_packcode);
|
||||
|
||||
// 货物入库
|
||||
public int IntoProductwarehouse(WmgoodsDto wmgoods, string createName);
|
||||
|
||||
//获取库位已经存在的货物
|
||||
public List<WmGoodsNowProduction> Getpackagelist(string location);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace ZR.Service.mes.wms.IService
|
||||
// 获取成品库信息
|
||||
public (List<WmInfo>,int) Getwminfo_product(string shelf , int layer, int pageNum , int pageSize);
|
||||
|
||||
|
||||
|
||||
// 获取库位信息
|
||||
public WmInfo Getlocationinfo(int warehouse_num, string locationcode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
|
||||
@@ -17,6 +19,85 @@ namespace ZR.Service.mes.wms
|
||||
[AppService(ServiceType = typeof(IWMentryWarehousing_productService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMentryWarehousing_productService : BaseService<WmInfo>, IWMentryWarehousing_productService
|
||||
{
|
||||
//货物入库
|
||||
public int IntoProductwarehouse(WmgoodsDto wmgoods, string createName)
|
||||
{
|
||||
List<WmGoodsNowProduction> preparegoodsList = new List<WmGoodsNowProduction>();
|
||||
if (wmgoods.packagelist != null && wmgoods.packagelist.Count() > 0)
|
||||
{
|
||||
for (int i = 0; i < wmgoods.packagelist.Count(); i++)
|
||||
{
|
||||
WmGoodsNowProduction wmGood = new WmGoodsNowProduction();
|
||||
wmGood.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
|
||||
|
||||
wmGood.PackageCode = Getpack_no(wmgoods.packagelist[i]);
|
||||
wmGood.LocationCode = wmgoods.location;
|
||||
|
||||
string workorder_id = wmgoods.packagelist[i].Substring(3, 9);
|
||||
|
||||
|
||||
wmGood.GoodsNumLogic = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == workorder_id)
|
||||
.Count();
|
||||
|
||||
wmGood.EntryWarehouseTime = DateTime.Now;
|
||||
wmGood.CreatedBy = createName;
|
||||
wmGood.CreatedTime = DateTime.Now;
|
||||
|
||||
|
||||
preparegoodsList.Add(wmGood);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int result = Context.Insertable(preparegoodsList).ExecuteCommand();
|
||||
return result;
|
||||
}
|
||||
|
||||
//判断箱子是否满
|
||||
public bool isFullPackage(string production_packcode)
|
||||
{
|
||||
string workorder_id = production_packcode.Substring(3, 9);
|
||||
string flow_id = production_packcode.Substring(13, 3);
|
||||
bool isExist = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == workorder_id)
|
||||
.Where(it => it.PackingCode.EndsWith(flow_id))
|
||||
.Where(it => it.BFilled == true).Any();
|
||||
return isExist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否为成品箱子码
|
||||
/// </summary>
|
||||
/// <param name="production_packcode"></param>
|
||||
/// <returns></returns>
|
||||
public int isProductionPackage(string production_packcode)
|
||||
{
|
||||
Regex r = new Regex("BNW_\\d{9}_\\d{3}");
|
||||
//todo 不是箱子
|
||||
if (!r.IsMatch(production_packcode))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
string workorder_id = production_packcode.Substring(3, 9);
|
||||
string flow_id = production_packcode.Substring(13, 3);
|
||||
bool isExist = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == workorder_id)
|
||||
.Where(it => it.PackingCode.EndsWith(flow_id))
|
||||
.Any();
|
||||
if (!isExist)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
bool IWMentryWarehousing_productService.IsProductionLoacation(string production_location_code)
|
||||
{
|
||||
|
||||
@@ -24,5 +105,35 @@ namespace ZR.Service.mes.wms
|
||||
.Where(it => it.Location.Equals(production_location_code)).Any();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取箱子唯一识别号
|
||||
/// </summary>
|
||||
/// <param name="production_packcode"></param>
|
||||
/// <returns></returns>
|
||||
private string Getpack_no(string production_packcode)
|
||||
{
|
||||
string workorder_id = production_packcode.Substring(3, 9);
|
||||
string flow_id = production_packcode.Substring(13, 3);
|
||||
|
||||
WmPackingrecord record = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == workorder_id)
|
||||
.Where(it => it.PackingCode.EndsWith(flow_id))
|
||||
.First();
|
||||
|
||||
|
||||
if (record == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return record.ProductCode;
|
||||
}
|
||||
|
||||
//获取库位已经存在的货物
|
||||
public List<WmGoodsNowProduction> Getpackagelist(string location)
|
||||
{
|
||||
return Context.Queryable<WmGoodsNowProduction>().Where(it=>it.LocationCode==location).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,18 @@ namespace ZR.Service.mes.wms
|
||||
[AppService(ServiceType = typeof(IWMlocationInfoService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMlocationInfoService : BaseService<WmInfo>, IWMlocationInfoService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询库位信息
|
||||
/// </summary>
|
||||
/// <param name="warehouse_num"></param>
|
||||
/// <param name="locationcode"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public WmInfo Getlocationinfo(int warehouse_num, string locationcode)
|
||||
{
|
||||
return Context.Queryable<WmInfo>().Where(it=>it.WarehouseNum== warehouse_num && it.Location==locationcode).First();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取成品库库位信息
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user