Merge branch 'production' of https://gitee.com/doan-tech/shanghaigangxiangtuzhuangMES
# Conflicts: # ZR.Admin.WebApi/appsettings.development.json
This commit is contained in:
26
ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs
Normal file
26
ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
public interface IWMExitwarehouseService
|
||||
{
|
||||
/// <summary>
|
||||
/// 一般退库
|
||||
/// </summary>
|
||||
/// <param name="original"></param>
|
||||
/// <returns></returns>
|
||||
public bool ExitwarehouseCommmon(string original);
|
||||
/// <summary>
|
||||
/// 判断箱子是否存在陈平库中
|
||||
/// </summary>
|
||||
/// <param name="originalCode"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public bool IsExistedWarehouse(string originalCode);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.wms;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
public interface IWMentryWarehousing_productService
|
||||
{
|
||||
|
||||
|
||||
// 获取库位列表
|
||||
public bool IsProductionLoacation(string production_location_code);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using static Org.BouncyCastle.Crypto.Engines.SM2Engine;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
public interface IWMentryWarehousing_productService
|
||||
{
|
||||
|
||||
|
||||
// 获取库位列表
|
||||
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);
|
||||
|
||||
//解析外箱标签码
|
||||
public ResultionPackageCodeDto ResolutionPackage(string code);
|
||||
|
||||
public bool IsExistedWarehouse(string originalCode);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
25
ZR.Service/mes/wms/IService/IWmCustomService.cs
Normal file
25
ZR.Service/mes/wms/IService/IWmCustomService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户信息service接口
|
||||
/// </summary>
|
||||
public interface IWmCustomService : IBaseService<WmCustom>
|
||||
{
|
||||
PagedInfo<WmCustomDto> GetList(WmCustomQueryDto parm);
|
||||
|
||||
WmCustom GetInfo(int Id);
|
||||
|
||||
WmCustom AddWmCustom(WmCustom parm);
|
||||
|
||||
int UpdateWmCustom(WmCustom parm);
|
||||
|
||||
}
|
||||
}
|
||||
24
ZR.Service/mes/wms/IService/IWmMaterialService.cs
Normal file
24
ZR.Service/mes/wms/IService/IWmMaterialService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料记录表service接口
|
||||
/// </summary>
|
||||
public interface IWmMaterialService : IBaseService<WmMaterial>
|
||||
{
|
||||
PagedInfo<WmMaterialDto> GetList(WmMaterialQueryDto parm);
|
||||
|
||||
WmMaterial GetInfo(string Id);
|
||||
|
||||
WmMaterial AddWmMaterial(WmMaterial parm);
|
||||
|
||||
int UpdateWmMaterial(WmMaterial parm);
|
||||
|
||||
}
|
||||
}
|
||||
30
ZR.Service/mes/wms/IService/IWmOutOrderService.cs
Normal file
30
ZR.Service/mes/wms/IService/IWmOutOrderService.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 出货单(物料+客户)service接口
|
||||
/// </summary>
|
||||
public interface IWmOutOrderService : IBaseService<WmOutOrder>
|
||||
{
|
||||
PagedInfo<WmOutOrderDto> GetList(WmOutOrderQueryDto parm);
|
||||
|
||||
WmOutOrder_material_num GetInfo(string ShipmentNum);
|
||||
|
||||
WmOutOrder AddWmOutOrder(WmOutOrder_materialDto parm);
|
||||
|
||||
int UpdateWmOutOrder(WmOutOrder parm);
|
||||
|
||||
|
||||
List<WmCustom> GetCustominfo();
|
||||
|
||||
(List<WmMaterialQuery_stockQuantityDto>, int) GetmaterialList(WmMaterialQueryDto parm);
|
||||
|
||||
}
|
||||
}
|
||||
115
ZR.Service/mes/wms/WMExitwarehouseService.cs
Normal file
115
ZR.Service/mes/wms/WMExitwarehouseService.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.pro;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
|
||||
[AppService(ServiceType = typeof(IWMExitwarehouseService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMExitwarehouseService : BaseService<WmInfo>, IWMExitwarehouseService
|
||||
{
|
||||
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
//普通入库
|
||||
public bool ExitwarehouseCommmon(string original)
|
||||
{
|
||||
ResultionPackageCodeDto packageCode = ResolutionPackagecode(original);
|
||||
string patchCode = packageCode.PatchCode;
|
||||
|
||||
|
||||
int result = Context.Deleteable<WmGoodsNowProduction>().Where(it => it.PackageCodeClient == patchCode).ExecuteCommand();
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断箱子是否在成品库中
|
||||
/// </summary>
|
||||
/// <param name="PatchCode"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public bool IsExistedWarehouse(string originalCode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackage = ResolutionPackagecode(originalCode);
|
||||
|
||||
return Context.Queryable<WmGoodsNowProduction>().Where(it => it.PackageCodeClient == resultionPackage.PatchCode).Any();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 解析外箱标签码
|
||||
/// </summary>
|
||||
/// <param name="packagecode"></param>
|
||||
/// <returns></returns>
|
||||
private ResultionPackageCodeDto ResolutionPackagecode(string packagecode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto();
|
||||
try
|
||||
{
|
||||
resultionPackageCode.originalCode = packagecode;
|
||||
|
||||
// todo 解析外箱标签码
|
||||
string[] splitstr = packagecode.Split('^');
|
||||
resultionPackageCode.PatchCode = splitstr[0].Substring(5);
|
||||
|
||||
//todo 解析零件号
|
||||
string partnumber = splitstr[1].Substring(11);
|
||||
//int length = lingshi.Length - 2;
|
||||
//string partnumber = lingshi.Substring(0, length);
|
||||
resultionPackageCode.PartNumner = partnumber;
|
||||
//todo 解析工单号
|
||||
string workoderidid = splitstr[2].Substring(7);
|
||||
resultionPackageCode.WorkoderID = workoderidid;
|
||||
//todo 生产描述
|
||||
resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6);
|
||||
//todo 解析箱子中产品数量
|
||||
string product_num = splitstr[3].Substring(4);
|
||||
resultionPackageCode.Quantity = product_num;
|
||||
//todo 产品描述 partnumber
|
||||
// ProWorklplan_v2 plan= Context.Queryable<ProWorklplan_v2>().Where(it => it.Partnumber == partnumber).First();
|
||||
//if(plan != null)
|
||||
// {
|
||||
// resultionPackageCode.ProductionDescribe = plan.ProductName;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// resultionPackageCode.ProductionDescribe = "生产计划无此零件号";
|
||||
// }
|
||||
ProWorkorder_v2 workorder = Context.Queryable<ProWorkorder_v2>().Where(it => it.FinishedPartNumber == partnumber).First();
|
||||
|
||||
if (workorder != null)
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = workorder.ProductDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "生产工单无此零件号";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error($"外箱标签码,解析失败 {ex.Message}");
|
||||
|
||||
}
|
||||
|
||||
return resultionPackageCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,22 +1,180 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Aliyun.OSS;
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Model.DBModel;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.pro;
|
||||
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;
|
||||
using static Org.BouncyCastle.Crypto.Engines.SM2Engine;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
[AppService(ServiceType = typeof(IWMentryWarehousing_productService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMentryWarehousing_productService : BaseService<WmInfo>, IWMentryWarehousing_productService
|
||||
{
|
||||
|
||||
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
//货物入库
|
||||
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++)
|
||||
{
|
||||
|
||||
ResultionPackageCodeDto resultionPackage= ResolutionPackagecode(wmgoods.packagelist[i]);
|
||||
WmGoodsNowProduction wmGood = new WmGoodsNowProduction();
|
||||
wmGood.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
|
||||
string flow = resultionPackage.PatchCode.Split('_')[1];
|
||||
int flow_num = 0;
|
||||
try
|
||||
{
|
||||
flow_num = Convert.ToInt32(flow);
|
||||
}catch(Exception ex)
|
||||
{
|
||||
flow_num = -1;
|
||||
}
|
||||
|
||||
wmGood.PackageCode = Getpack_no(resultionPackage.WorkoderID, flow_num.ToString("000"));
|
||||
wmGood.PackageCodeClient = resultionPackage.PatchCode;
|
||||
wmGood.Partnumber = resultionPackage.PartNumner;
|
||||
wmGood.PackageCodeOriginal = resultionPackage.originalCode;
|
||||
|
||||
wmGood.LocationCode = wmgoods.location;
|
||||
|
||||
string workorder_id = resultionPackage.WorkoderID;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取mes的箱子码
|
||||
/// </summary>
|
||||
/// <param name="workordorid">工单</param>
|
||||
/// <param name="flow">序号</param>
|
||||
/// <returns></returns>
|
||||
private string Getpack_no(string workordorid, string flow)
|
||||
{
|
||||
|
||||
|
||||
WmPackingrecord record = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == workordorid)
|
||||
.Where(it => it.PackingCode.EndsWith(flow))
|
||||
.First();
|
||||
|
||||
|
||||
if (record == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return record.ProductCode;
|
||||
}
|
||||
|
||||
//3 判断箱子是否满
|
||||
public bool isFullPackage(string production_packcode)
|
||||
{
|
||||
ResultionPackageCodeDto Identity = ResolutionPackagecode(production_packcode);
|
||||
if (Identity == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string packingCode = Identity.PatchCode.Split('_')[1];
|
||||
|
||||
|
||||
bool isExist = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == Identity.WorkoderID)
|
||||
.Where(it => it.PackingCode.EndsWith(packingCode))
|
||||
.Where(it => it.BFilled == true)
|
||||
.Any();
|
||||
|
||||
|
||||
|
||||
return isExist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 2 判断是否为成品箱子码
|
||||
/// </summary>
|
||||
/// <param name="production_packcode"></param>
|
||||
/// <returns></returns>
|
||||
public int isProductionPackage(string production_packcode)
|
||||
{
|
||||
|
||||
|
||||
Regex r = new Regex("Code=BNW\\d{9}_\\d{0,3}");
|
||||
|
||||
|
||||
//todo 不是箱子
|
||||
if (!r.IsMatch(production_packcode))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
ResultionPackageCodeDto Identity = ResolutionPackagecode(production_packcode);
|
||||
if (Identity == null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
string packingCode = Identity.PatchCode.Split('_')[1];
|
||||
|
||||
|
||||
|
||||
|
||||
bool isExist = Context.Queryable<WmPackingrecord>()
|
||||
.Where(it => it.WorkOrderNum == Identity.WorkoderID)
|
||||
.Where(it => it.PackingCode.EndsWith(packingCode))
|
||||
.Any();
|
||||
if (!isExist)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
//1 判断是否为库位码
|
||||
bool IWMentryWarehousing_productService.IsProductionLoacation(string production_location_code)
|
||||
{
|
||||
|
||||
@@ -24,5 +182,96 @@ namespace ZR.Service.mes.wms
|
||||
.Where(it => it.Location.Equals(production_location_code)).Any();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取库位已经存在的货物
|
||||
public List<WmGoodsNowProduction> Getpackagelist(string location)
|
||||
{
|
||||
return Context.Queryable<WmGoodsNowProduction>().Where(it => it.LocationCode == location).ToList();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析外箱标签码
|
||||
/// </summary>
|
||||
/// <param name="packagecode"></param>
|
||||
/// <returns></returns>
|
||||
private ResultionPackageCodeDto ResolutionPackagecode(string packagecode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto();
|
||||
try
|
||||
{
|
||||
resultionPackageCode.originalCode= packagecode;
|
||||
|
||||
// todo 解析外箱标签码
|
||||
string[] splitstr = packagecode.Split('^');
|
||||
resultionPackageCode.PatchCode = splitstr[0].Substring(5);
|
||||
|
||||
//todo 解析零件号
|
||||
string partnumber = splitstr[1].Substring(11);
|
||||
//int length = lingshi.Length - 2;
|
||||
//string partnumber = lingshi.Substring(0, length);
|
||||
resultionPackageCode.PartNumner = partnumber;
|
||||
//todo 解析工单号
|
||||
string workoderidid = splitstr[2].Substring(7);
|
||||
resultionPackageCode.WorkoderID = workoderidid;
|
||||
//todo 生产描述
|
||||
resultionPackageCode.ProductionTime="20"+ workoderidid.Substring(0,6);
|
||||
//todo 解析箱子中产品数量
|
||||
string product_num = splitstr[3].Substring(4);
|
||||
resultionPackageCode.Quantity = product_num;
|
||||
//todo 产品描述 partnumber
|
||||
// ProWorklplan_v2 plan= Context.Queryable<ProWorklplan_v2>().Where(it => it.Partnumber == partnumber).First();
|
||||
//if(plan != null)
|
||||
// {
|
||||
// resultionPackageCode.ProductionDescribe = plan.ProductName;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// resultionPackageCode.ProductionDescribe = "生产计划无此零件号";
|
||||
// }
|
||||
ProWorkorder_v2 workorder= Context.Queryable<ProWorkorder_v2>().Where(it => it.FinishedPartNumber == partnumber).First();
|
||||
|
||||
if (workorder != null)
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = workorder.ProductDescription;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultionPackageCode.ProductionDescribe = "生产工单无此零件号";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error($"外箱标签码,解析失败 {ex.Message}");
|
||||
|
||||
}
|
||||
|
||||
return resultionPackageCode;
|
||||
}
|
||||
|
||||
//解析外箱标签码
|
||||
public ResultionPackageCodeDto ResolutionPackage(string code)
|
||||
{
|
||||
|
||||
|
||||
return ResolutionPackagecode(code);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 判断箱子是否在成品库中
|
||||
/// </summary>
|
||||
/// <param name="PatchCode"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public bool IsExistedWarehouse(string originalCode)
|
||||
{
|
||||
ResultionPackageCodeDto resultionPackage= ResolutionPackagecode(originalCode);
|
||||
|
||||
return Context.Queryable<WmGoodsNowProduction>().Where(it => it.PackageCodeClient == resultionPackage.PatchCode).Any();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
91
ZR.Service/mes/wms/WmCustomService.cs
Normal file
91
ZR.Service/mes/wms/WmCustomService.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
|
||||
using ZR.Repository;
|
||||
|
||||
using System.Linq;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 客户信息Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmCustomService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmCustomService : BaseService<WmCustom>, IWmCustomService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询客户信息列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmCustomDto> GetList(WmCustomQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmCustom>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.CustomNo), it => it.CustomNo.Contains(parm.CustomNo))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.CustomName), it => it.CustomName.Contains(parm.CustomName));
|
||||
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<WmCustom, WmCustomDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmCustom GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加客户信息
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmCustom AddWmCustom(WmCustom model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改客户信息
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmCustom(WmCustom model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmCustom()
|
||||
//{
|
||||
// CustomNo = model.CustomNo,
|
||||
// CustomName = model.CustomName,
|
||||
// CustomAddress = model.CustomAddress,
|
||||
// Remark = model.Remark,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
108
ZR.Service/mes/wms/WmMaterialService.cs
Normal file
108
ZR.Service/mes/wms/WmMaterialService.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using ZR.Model;
|
||||
using ZR.Model.Dto;
|
||||
|
||||
using ZR.Repository;
|
||||
|
||||
using System.Linq;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料记录表Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmMaterialService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmMaterialService : BaseService<WmMaterial>, IWmMaterialService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询物料记录表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmMaterialDto> GetList(WmMaterialQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmMaterial>()
|
||||
.AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber))
|
||||
.AndIF(parm.U8InventoryCode != null, it => it.U8InventoryCode.Contains(parm.U8InventoryCode))
|
||||
.AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName))
|
||||
.AndIF(parm.Color != null, it => it.Color.Contains(parm.Color))
|
||||
.AndIF(parm.Specification != null, it => it.Specification.Contains(parm.Specification))
|
||||
.AndIF(parm.Description != null, it => it.Description.Contains(parm.Description))
|
||||
.AndIF(parm.Search1 != null, it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1))
|
||||
.AndIF(parm.Status > -1, it => it.Status == parm.Status);
|
||||
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression()).OrderByDescending(it=>it.CreatedTime)
|
||||
.ToPage<WmMaterial, WmMaterialDto>(parm);
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmMaterial GetInfo(string Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加物料记录表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmMaterial AddWmMaterial(WmMaterial model)
|
||||
{
|
||||
model.Id= SnowFlakeSingle.Instance.NextId().ToString();
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改物料记录表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmMaterial(WmMaterial model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmMaterial()
|
||||
//{
|
||||
// Partnumber = model.Partnumber,
|
||||
// U8InventoryCode = model.U8InventoryCode,
|
||||
// BlankNum = model.BlankNum,
|
||||
// Unit = model.Unit,
|
||||
// ProductName = model.ProductName,
|
||||
// Color = model.Color,
|
||||
// Specification = model.Specification,
|
||||
// Description = model.Description,
|
||||
// Version = model.Version,
|
||||
// Remarks = model.Remarks,
|
||||
// Sort = model.Sort,
|
||||
// Search1 = model.Search1,
|
||||
// Search2 = model.Search2,
|
||||
// Status = model.Status,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
224
ZR.Service/mes/wms/WmOutOrderService.cs
Normal file
224
ZR.Service/mes/wms/WmOutOrderService.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Model;
|
||||
using ZR.Repository;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
using Mapster;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
/// <summary>
|
||||
/// 出货单(物料+客户)Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmOutOrderService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmOutOrderService : BaseService<WmOutOrder>, IWmOutOrderService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询出货单(物料+客户)列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmOutOrderDto> GetList(WmOutOrderQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmOutOrder>();
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.ToPage<WmOutOrder, WmOutOrderDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="ShipmentNum"></param>
|
||||
/// <returns></returns>
|
||||
public WmOutOrder_material_num GetInfo(string ShipmentNum)
|
||||
{
|
||||
|
||||
WmOutOrder WmOutOrderList = Context.Queryable<WmOutOrder>()
|
||||
.Where(it => it.ShipmentNum == ShipmentNum)
|
||||
.First();
|
||||
|
||||
WmOutOrder_material_num wmOutOrderItem = null;
|
||||
|
||||
if (WmOutOrderList != null)
|
||||
{
|
||||
wmOutOrderItem = WmOutOrderList.Adapt<WmOutOrder_material_num>();
|
||||
|
||||
List<WmMaterialOutorder> moList = Context.Queryable<WmMaterialOutorder>()
|
||||
.Where(it => it.FkOutorderId == WmOutOrderList.ShipmentNum)
|
||||
.ToList();
|
||||
|
||||
if (moList != null && moList.Count > 0)
|
||||
{
|
||||
List<WmMaterialQuery_stockQuantityDto2> Material_stock = new List<WmMaterialQuery_stockQuantityDto2>();
|
||||
|
||||
foreach (var moItem in moList)
|
||||
{
|
||||
WmMaterial material = Context.Queryable<WmMaterial>().Where(it => it.Id == moItem.FkMaterialId).First();
|
||||
WmMaterialQuery_stockQuantityDto2 dto2 = material.Adapt<WmMaterialQuery_stockQuantityDto2>();
|
||||
dto2.requireOutNum = moItem.OuthouseNum;
|
||||
Material_stock.Add(dto2);
|
||||
}
|
||||
wmOutOrderItem.MaterialList = Material_stock;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return wmOutOrderItem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加出货单(物料+客户)
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmOutOrder AddWmOutOrder(WmOutOrder_materialDto model)
|
||||
{
|
||||
string today_id = "EG" + DateTime.Now.ToString("yyMMdd");
|
||||
string last_outorder_ShipmentNum = Context.Queryable<WmOutOrder>().Where(it => it.ShipmentNum.StartsWith(today_id)).Max(it => it.ShipmentNum);
|
||||
if (string.IsNullOrEmpty(last_outorder_ShipmentNum))
|
||||
{
|
||||
model.ShipmentNum = today_id + "001";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
int flow = int.Parse(last_outorder_ShipmentNum.Substring(last_outorder_ShipmentNum.Length - 3, 3)) + 1;
|
||||
model.ShipmentNum = today_id + flow.ToString("000");
|
||||
|
||||
}
|
||||
WmOutOrder wmOutOrder = model.Adapt<WmOutOrder>();
|
||||
|
||||
// 关联表也要新增
|
||||
if (model.MaterialList != null)
|
||||
{
|
||||
if (model.MaterialList.Count > 0)
|
||||
{
|
||||
List<WmMaterialOutorder> materialOutorderList = new List<WmMaterialOutorder>();
|
||||
|
||||
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);
|
||||
};
|
||||
int result = Context.Insertable(materialOutorderList).ExecuteCommand();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Context.Insertable(wmOutOrder).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// <returns></returns>
|
||||
public List<WmCustom> GetCustominfo()
|
||||
{
|
||||
|
||||
return Context.Queryable<WmCustom>().ToList();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询物料记录表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public (List<WmMaterialQuery_stockQuantityDto>, int) GetmaterialList(WmMaterialQueryDto parm)
|
||||
{
|
||||
int total = 0;
|
||||
var predicate = Expressionable.Create<WmMaterial>()
|
||||
.AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber))
|
||||
.AndIF(parm.U8InventoryCode != null, it => it.U8InventoryCode.Contains(parm.U8InventoryCode))
|
||||
.AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName))
|
||||
.AndIF(parm.Color != null, it => it.Color.Contains(parm.Color))
|
||||
.AndIF(parm.Specification != null, it => it.Specification.Contains(parm.Specification))
|
||||
.AndIF(parm.Description != null, it => it.Description.Contains(parm.Description))
|
||||
.AndIF(parm.Search1 != null, it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1))
|
||||
.AndIF(parm.Status > -1, it => it.Status == parm.Status);
|
||||
|
||||
|
||||
List<WmMaterial> materialList = Context.Queryable<WmMaterial>()
|
||||
.Where(predicate.ToExpression()).OrderByDescending(it => it.CreatedTime)
|
||||
.ToPageList(parm.PageNum, parm.PageSize, ref total);
|
||||
|
||||
|
||||
List<WmMaterialQuery_stockQuantityDto> material_stockQuantity_list = new List<WmMaterialQuery_stockQuantityDto>();
|
||||
|
||||
|
||||
if (materialList.Count > 0)
|
||||
{
|
||||
foreach (WmMaterial item in materialList)
|
||||
{
|
||||
|
||||
WmMaterialQuery_stockQuantityDto wmMaterialQuery_Stock_item = item.Adapt<WmMaterialQuery_stockQuantityDto>();
|
||||
|
||||
int material_num = 0;
|
||||
List<WmGoodsNowProduction> productioList = Context
|
||||
.Queryable<WmGoodsNowProduction>()
|
||||
.Where(it => it.Partnumber == item.Partnumber)
|
||||
.ToList();
|
||||
|
||||
if (productioList.Count > 0)
|
||||
{
|
||||
foreach (var product in productioList)
|
||||
{
|
||||
material_num = material_num + (int)product.GoodsNumLogic;
|
||||
}
|
||||
}
|
||||
wmMaterialQuery_Stock_item.stockQuantity = material_num;
|
||||
material_stockQuantity_list.Add(wmMaterialQuery_Stock_item);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return (material_stockQuantity_list, total);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user