Merge branch 'production' of https://gitee.com/doan-tech/shanghaigangxiangtuzhuangMES
# Conflicts: # ZR.Admin.WebApi/appsettings.development.json
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="mes\md\MdMaterialReceiptService.cs" />
|
||||
<Compile Remove="mes\wm\IService\IMdMaterialReceiptService.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Common;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.wm;
|
||||
using ZR.Service.mes.pro.IService;
|
||||
using ZR.Service.MES.md.IService;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
using JinianNet.JNTemplate;
|
||||
using static Aliyun.OSS.Model.LiveChannelStat;
|
||||
using ZR.Model.MES.pro.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
|
||||
namespace ZR.Service.mes.pro
|
||||
{
|
||||
[AppService(ServiceType = typeof(IProWorkorderService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ProWorkorderService : BaseService<ProWorkorder>, IProWorkorderService
|
||||
{
|
||||
|
||||
public (List<ProWorkorder>, int) GetWorkorderList(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
|
||||
{
|
||||
|
||||
var predicate = Expressionable.Create<ProWorkorder>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.AndIF(isSchedule == 0, it => it.Wrokerorder_status.Equals(isSchedule))
|
||||
.AndIF(isSchedule >= 1, it => it.Wrokerorder_status >= 1)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).OrderBy(it => it.Order).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (proWorkorderList, totalCount);
|
||||
}
|
||||
|
||||
public int SetWorkorderSechedule(string id, DateTime arrange_starttime, DateTime arrange_endtime)
|
||||
{
|
||||
//获取排序最大值
|
||||
if (CacheHelper.GetCache("workorder_id_max") == null)
|
||||
{
|
||||
int? workorder_id_max = Context.Queryable<ProWorkorder>().OrderBy(it => it.Order, OrderByType.Desc).First().Order;
|
||||
//初次
|
||||
if (workorder_id_max == null || workorder_id_max == 0)
|
||||
{
|
||||
workorder_id_max = 1;
|
||||
}
|
||||
CacheHelper.SetCache("workorder_id_max", workorder_id_max);
|
||||
}
|
||||
CacheHelper.SetCache("workorder_id_max", (int)CacheHelper.GetCache("workorder_id_max") + 1);
|
||||
|
||||
|
||||
TimeSpan productionTime = arrange_endtime - arrange_starttime;
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => new ProWorkorder() { ArrangeStarttime = arrange_starttime, ArrangeEndtime = arrange_endtime, Wrokerorder_status = 1, ProductionTime = (decimal)productionTime.TotalMinutes, Order = (int)CacheHelper.GetCache("workorder_id_max") })
|
||||
.Where(it => it.Id.Equals(id))
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
public int ResetWorkorderSechedule(string id)
|
||||
{
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Wrokerorder_status == 0)
|
||||
.SetColumns(it => it.Order == 0)
|
||||
.Where(it => it.Id.Equals(id))
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
public int SortWorkorderSchedule(string id, int order)
|
||||
{
|
||||
return Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Order == order)
|
||||
.Where(it => it.Id.Equals(id))
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
public int ReleaseProduction(string id, HttpContext context)
|
||||
{
|
||||
int result = Context.Updateable<ProWorkorder>()
|
||||
.SetColumns(it => it.Wrokerorder_status == 2)
|
||||
.Where(it => it.Id.Equals(id))
|
||||
.ExecuteCommand();
|
||||
ProWorkorder workorder = Context.Queryable<ProWorkorder>().Where(it => it.Id == id).First();
|
||||
if (result == 1)
|
||||
{
|
||||
|
||||
// 生成领料单
|
||||
// 若没有此零件号的领料单,就新增,否则,修改累加
|
||||
|
||||
bool isExit = Context.Queryable<WmWorkorderMr>().Where(it => it.WorkorderId == workorder.Id).Any();
|
||||
if (!isExit)
|
||||
{
|
||||
// 新增 领料单
|
||||
WmMaterialrequisition materialrequisition = new WmMaterialrequisition();
|
||||
materialrequisition.CreatedBy = context.User?.Identity?.Name;
|
||||
materialrequisition.CreatedTime = DateTime.Now;
|
||||
materialrequisition.Year = workorder.Year;
|
||||
materialrequisition.Week = workorder.Week;
|
||||
materialrequisition.Date = workorder.Date;
|
||||
materialrequisition.Id = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
materialrequisition.Requirenum = workorder.Actualnumber;
|
||||
materialrequisition.Workblankpartnumber = workorder.Workblankpartnumber;
|
||||
materialrequisition.Status = "0";
|
||||
Context.Insertable(materialrequisition).ExecuteCommandAsync();
|
||||
// 新增工单-领料关联表
|
||||
WmWorkorderMr mr = new WmWorkorderMr();
|
||||
mr.Id = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
mr.WorkorderId = workorder.Id;
|
||||
mr.MaterialrequisitionId = materialrequisition.Id;
|
||||
mr.CreatedBy = context.User?.Identity?.Name;
|
||||
mr.CreatedTime = DateTime.Now;
|
||||
Context.Insertable(mr).ExecuteCommandAsync();
|
||||
|
||||
//新增领料单统计表
|
||||
QcRough qcRough=new QcRough ();
|
||||
qcRough.Id = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
qcRough.FkMaterialrequisitionId= materialrequisition.Id;
|
||||
qcRough.RequireNum = materialrequisition.Requirenum;
|
||||
qcRough.ActualNumber = materialrequisition.Requirenum;
|
||||
qcRough.CreatedBy= context.User?.Identity?.Name;
|
||||
qcRough.CreatedTime= DateTime.Now;
|
||||
qcRough.OksRatio = 10;
|
||||
Context.Insertable (qcRough).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
UseTran(() =>
|
||||
{
|
||||
//查询当前工单下的领料数量
|
||||
List<WmMaterialrequisition> wm = Context.Queryable<ProWorkorder>()
|
||||
.LeftJoin<WmWorkorderMr>((m, mr) => m.Id == mr.WorkorderId)
|
||||
.LeftJoin<WmMaterialrequisition>((m, mr, r) => mr.MaterialrequisitionId == r.Id)
|
||||
.Where(m => m.Id == id)
|
||||
.Select((m, mr, r) => r)
|
||||
.ToList();
|
||||
|
||||
wm[0].Requirenum += workorder.Actualnumber;
|
||||
wm[0].UpdatedTime = DateTime.Now;
|
||||
wm[0].UpdatedBy = context.User?.Identity?.Name;
|
||||
//更新领料单
|
||||
Context.Updateable(wm[0]);
|
||||
//更新检验表
|
||||
Context.Updateable<QcRough>().SetColumns(it => it.RequireNum == wm[0].Requirenum)
|
||||
.SetColumns(it => it.ActualNumber == wm[0].Requirenum)
|
||||
.Where(it => it.FkMaterialrequisitionId == wm[0].Id).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取甘特图
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="week"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public GanttTaskDTO GetGanttList(int year, int week, int date)
|
||||
{
|
||||
|
||||
|
||||
var predicate = Expressionable.Create<ProWorkorder>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.And(it=>it.Wrokerorder_status==2) // 已经排产
|
||||
.ToExpression();
|
||||
|
||||
|
||||
List<ProWorkorder> proWorkorderList = Context.Queryable<ProWorkorder>().Where(predicate).ToList();
|
||||
|
||||
|
||||
GanttTaskDTO ganttTask = new GanttTaskDTO();
|
||||
|
||||
List<GanttTask_data> ganttTask_data = new List<GanttTask_data>();
|
||||
List<GanttTask_link> ganttTask_Links = new List<GanttTask_link>();
|
||||
|
||||
foreach (var item in proWorkorderList)
|
||||
{
|
||||
GanttTask_data data = new GanttTask_data();
|
||||
data.id = item.Id;
|
||||
data.text = item.ProductionName;
|
||||
data.start_date = ((DateTime)item.ArrangeStarttime).ToString("yyyy-MM-dd");
|
||||
data.duration = item.ProductionTime;
|
||||
data.planned_start = ((DateTime)item.ArrangeStarttime).ToString("yyyy-MM-dd");
|
||||
data.planned_end = ((DateTime)item.ArrangeEndtime).ToString("yyyy-MM-dd");
|
||||
data.progress = 1;
|
||||
data.show = false;
|
||||
data.open = true;
|
||||
data.type = "project";
|
||||
|
||||
|
||||
GanttTask_link link = new GanttTask_link();
|
||||
link.id = item.Order;
|
||||
link.source = item.Order;
|
||||
int index = proWorkorderList.IndexOf(item);
|
||||
if (index < proWorkorderList.Count-1)
|
||||
link.target = (int)proWorkorderList[index + 1]?.Order;
|
||||
link.type = 0;
|
||||
|
||||
ganttTask_data.Add(data);
|
||||
ganttTask_Links.Add(link);
|
||||
|
||||
|
||||
}
|
||||
ganttTask.Data = ganttTask_data;
|
||||
ganttTask.Links = ganttTask_Links;
|
||||
return ganttTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Server.HttpSys;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.pro;
|
||||
using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wm;
|
||||
using ZR.Service.mes.pro.IService;
|
||||
using ZR.Service.mes.qu.IService;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Service.mes.qu
|
||||
{
|
||||
[AppService(ServiceType = typeof(IQcRoughService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class QcRoughService : BaseService<QcRough>, IQcRoughService
|
||||
{
|
||||
|
||||
public (List<Mr_QuRoughDTO>, int) GetStatisticslist(int pageNum, int pageSize, int year, int week, int date, int isSchedule)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmMaterialrequisition>()
|
||||
.AndIF(year > 0, wm => wm.Year == year)
|
||||
.AndIF(week > 0, wm => wm.Week == week)
|
||||
.AndIF(date > 0, wm => wm.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
|
||||
//联表查询
|
||||
List<Mr_QuRoughDTO> mr_QusList = Context.Queryable<WmMaterialrequisition>()
|
||||
.RightJoin<QcRough>((wm, qc) => wm.Id == qc.FkMaterialrequisitionId)
|
||||
.Where(predicate)
|
||||
.Select((wm, qc) => new Mr_QuRoughDTO
|
||||
{
|
||||
Id = qc.Id,
|
||||
FkMaterialrequisitionId = qc.FkMaterialrequisitionId,
|
||||
Workblankpartnumber = wm.Workblankpartnumber,
|
||||
Status = wm.Status,
|
||||
Year = wm.Year,
|
||||
Week = wm.Week,
|
||||
Date = wm.Date,
|
||||
RequireNum = qc.RequireNum,
|
||||
ActualNumber = qc.ActualNumber,
|
||||
RandomRate = qc.RandomRate,
|
||||
Oks = qc.Oks,
|
||||
Ngs = qc.Ngs,
|
||||
OksRatio = qc.OksRatio,
|
||||
IsFeeding = qc.IsFeeding
|
||||
})
|
||||
.ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (mr_QusList, totalCount);
|
||||
}
|
||||
|
||||
public int UpdateStatisticsTable(string id, int actualNumber, int randomRate, int ngs, int oks, decimal oksRatio, int Isqualified)
|
||||
{
|
||||
UseTran(() =>
|
||||
{
|
||||
QcRough qr = Queryable().Where(it => it.Id == id).First();
|
||||
if (qr != null)
|
||||
{
|
||||
//更新 领料单状态
|
||||
if (Isqualified == 1)
|
||||
{
|
||||
Context.Updateable<WmMaterialrequisition>().SetColumns(it => it.Status == "1").Where(it => it.Id == qr.FkMaterialrequisitionId);
|
||||
}
|
||||
else if (Isqualified == 0)
|
||||
{
|
||||
//不合格,依然处于未领料
|
||||
|
||||
//新增退料单
|
||||
WmMaterialrequisition materialrequisition = Context.Queryable<WmMaterialrequisition>().Where(it => it.Id == qr.FkMaterialrequisitionId).First();
|
||||
|
||||
|
||||
WmMaterialreturn materialreturn = new WmMaterialreturn();
|
||||
materialreturn.Id = DateTime.Now.ToString("yyyyMMdd");
|
||||
materialreturn.FkMrqrId = qr.FkMaterialrequisitionId;
|
||||
materialreturn.Year = materialrequisition.Year;
|
||||
materialreturn.Week = materialrequisition.Week;
|
||||
materialreturn.Date = materialrequisition.Date;
|
||||
materialreturn.Workblankpartnumber = materialrequisition.Workblankpartnumber;
|
||||
materialreturn.Requirenum = materialrequisition.Requirenum;
|
||||
|
||||
Context.Insertable(materialrequisition).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
return Context.Updateable<QcRough>()
|
||||
.SetColumns(it => it.ActualNumber == actualNumber)
|
||||
.SetColumns(it => it.RandomRate == randomRate)
|
||||
.SetColumns(it => it.Ngs == ngs)
|
||||
.SetColumns(it => it.Oks == oks)
|
||||
.SetColumns(it => it.OksRatio == oksRatio)
|
||||
.Where(it => it.Id == id).ExecuteCommand();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.wm;
|
||||
using ZR.Model.MES.wm.DTO;
|
||||
|
||||
namespace ZR.Service.mes.wm.IService
|
||||
{
|
||||
public interface IMaterialReceiptService
|
||||
{
|
||||
public (List<WmMaterialReceiptDTO>, int) GetWmMaterialReceiptList(int pageNum, int pageSize, int year, int week, int day);
|
||||
|
||||
public int SaveOneMaterialReceipt(WmMaterialReceiptDTO wmMaterialReceiptDTO);
|
||||
|
||||
public string SavePageMaterialReceipts(List<WmMaterialReceiptDTO> list);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.wm;
|
||||
|
||||
namespace ZR.Service.mes.wm.IService
|
||||
{
|
||||
public interface IMaterialRequisitionService
|
||||
{
|
||||
|
||||
public (List<WmMaterialrequisition>, int) GetmaterialsRequisition(int pageNum, int pageSize, int year , int week , int date );
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.wm;
|
||||
|
||||
namespace ZR.Service.mes.wm.IService
|
||||
{
|
||||
public interface IMaterialreturnService
|
||||
{
|
||||
|
||||
public (List<WmMaterialreturn>, int) Getmaterialreturn(int pageNum, int pageSize, int year, int week, int date);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZR.Service.mes.md.IService
|
||||
{
|
||||
internal interface IMdMaterialReceiptService
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
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.wm;
|
||||
using ZR.Model.MES.wm.DTO;
|
||||
using ZR.Service.mes.wm.IService;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Service.mes.wm
|
||||
{
|
||||
[AppService(ServiceType = typeof(IMaterialReceiptService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MaterialReceiptService : BaseService<WmMaterialReceipt>, IMaterialReceiptService
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成并查询原材料入库单
|
||||
/// 根据生产工单进行生成,以生产工单为主
|
||||
/// </summary>
|
||||
public (List<WmMaterialReceiptDTO>, int) GetWmMaterialReceiptList(int pageNum, int pageSize, int year, int week, int date)
|
||||
{
|
||||
var predicate = Expressionable.Create<ProWorkorder_v2>()
|
||||
.AndIF(year > 0, pw2 => pw2.Year == year)
|
||||
.AndIF(week > 0, pw2 => pw2.Week == week)
|
||||
.AndIF(date > 0, pw2 => pw2.Date == date)
|
||||
//.And(pw2=>pw2.Status == 2)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<WmMaterialReceiptDTO> list = Context.Queryable<ProWorkorder_v2, WmMaterialReceipt>((pw2, wmr) => new object[]
|
||||
{
|
||||
JoinType.Left,
|
||||
pw2.Id == wmr.FkWorkorder2Id
|
||||
})
|
||||
.Where(predicate)
|
||||
.Select((pw2, wmr) => new WmMaterialReceiptDTO
|
||||
{
|
||||
FkWorkorderId = pw2.Id,
|
||||
ProductDescription = pw2.ProductDescription,
|
||||
Colour = pw2.Colour,
|
||||
Specifications = pw2.Specifications,
|
||||
BlankNumber = pw2.BlankNumber,
|
||||
PreviousNumber = pw2.PreviousNumber,
|
||||
Sort = pw2.Sort,
|
||||
Id = wmr.Id,
|
||||
ActualNumber = wmr.ActualNumber,
|
||||
SampleNumber = wmr.SampleNumber,
|
||||
QualifiedNumber = wmr.QualifiedNumber,
|
||||
PassRate = wmr.PassRate,
|
||||
Status = wmr.Status
|
||||
})
|
||||
.OrderBy(pw2 => pw2.Sort)
|
||||
.ToPageList(pageNum, pageSize, ref totalCount);
|
||||
return (list, totalCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存一条原材料入库单数据
|
||||
/// 如果传来的id为空则新增
|
||||
/// 否则就修改
|
||||
/// 0 =数据库操作异常
|
||||
/// -1=传入参数异常
|
||||
/// </summary>
|
||||
|
||||
public int SaveOneMaterialReceipt(WmMaterialReceiptDTO wmMaterialReceiptDTO)
|
||||
{
|
||||
if(wmMaterialReceiptDTO == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(wmMaterialReceiptDTO.FkWorkorderId == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
WmMaterialReceipt wmMaterialReceipt = new WmMaterialReceipt();
|
||||
wmMaterialReceipt.FkWorkorder2Id = wmMaterialReceiptDTO.FkWorkorderId;
|
||||
wmMaterialReceipt.ActualNumber = wmMaterialReceiptDTO.ActualNumber;
|
||||
wmMaterialReceipt.SampleNumber = wmMaterialReceiptDTO.SampleNumber;
|
||||
wmMaterialReceipt.QualifiedNumber = wmMaterialReceiptDTO.QualifiedNumber;
|
||||
wmMaterialReceipt.FkWarehouseId = wmMaterialReceiptDTO.FkWorkorderId;
|
||||
wmMaterialReceipt.Status = wmMaterialReceiptDTO.Status;
|
||||
|
||||
if (IsIdNull(wmMaterialReceiptDTO))
|
||||
{
|
||||
// XXX 雪花算法WorkId需要不同,可能会出现未知异常;
|
||||
// SnowFlakeSingle.WorkId = 22;
|
||||
wmMaterialReceipt.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
wmMaterialReceipt.CreatedBy = wmMaterialReceiptDTO.Operator;
|
||||
wmMaterialReceipt.UpdatedBy = wmMaterialReceiptDTO.Operator;
|
||||
// XXX 时间为粗略时间
|
||||
wmMaterialReceipt.CreatedTime = DateTime.Now;
|
||||
wmMaterialReceipt.UpdatedTime = DateTime.Now;
|
||||
int effectId = Context.Insertable(wmMaterialReceipt).ExecuteCommand();
|
||||
return effectId;
|
||||
}
|
||||
else
|
||||
{
|
||||
wmMaterialReceipt.Id = wmMaterialReceiptDTO.Id;
|
||||
wmMaterialReceipt.UpdatedBy = wmMaterialReceiptDTO.Operator;
|
||||
wmMaterialReceipt.UpdatedTime = DateTime.Now;
|
||||
int effectId = Context.Updateable(wmMaterialReceipt).IgnoreColumns(ignoreAllNullColumns:true).ExecuteCommand();
|
||||
return effectId;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 保存前端一整页(多条)原材料入库单数据
|
||||
/// </summary>
|
||||
public string SavePageMaterialReceipts(List<WmMaterialReceiptDTO> list)
|
||||
{
|
||||
if (list == null || list.Count == 0)
|
||||
{
|
||||
return $"保存成功:无数据变动!";
|
||||
}
|
||||
int successCount = 0;
|
||||
int totalCount = list.Count;
|
||||
|
||||
for(int index = 1; index <= list.Count; index++)
|
||||
{
|
||||
int effectId = SaveOneMaterialReceipt(list[index-1]);
|
||||
if (effectId < 1)
|
||||
{
|
||||
return $"保存异常:总共{totalCount}条数据已成功保存{successCount}条数据,异常行数{index}";
|
||||
}
|
||||
}
|
||||
return $"保存成功:成功保存{totalCount}条数据";
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断id是否为空
|
||||
/// </summary>
|
||||
///
|
||||
public bool IsIdNull(WmMaterialReceiptDTO wmMaterialReceiptDTO)
|
||||
{
|
||||
if (wmMaterialReceiptDTO.Id is null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ("".Equals(wmMaterialReceiptDTO.Id))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
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.qu;
|
||||
using ZR.Model.MES.wm;
|
||||
using ZR.Service.mes.qu.IService;
|
||||
using ZR.Service.mes.wm.IService;
|
||||
|
||||
namespace ZR.Service.mes.wm
|
||||
{
|
||||
|
||||
|
||||
[AppService(ServiceType = typeof(IMaterialRequisitionService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MaterialRequisitionService : BaseService<WmMaterialrequisition>, IMaterialRequisitionService
|
||||
{
|
||||
|
||||
|
||||
public (List<WmMaterialrequisition>, int) GetmaterialsRequisition(int pageNum, int pageSize, int year, int week, int date)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmMaterialrequisition>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.And(it=>it.Status=="0")
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<WmMaterialrequisition> wmmr = Context.Queryable<WmMaterialrequisition>().Where(predicate).OrderBy(it => it.Id).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (wmmr, totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wm;
|
||||
using ZR.Service.mes.wm.IService;
|
||||
|
||||
namespace ZR.Service.mes.wm
|
||||
{
|
||||
|
||||
|
||||
[AppService(ServiceType = typeof(IMaterialreturnService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MaterialreturnService : BaseService<WmMaterialreturn>, IMaterialreturnService
|
||||
{
|
||||
public (List<WmMaterialreturn>, int) Getmaterialreturn(int pageNum, int pageSize, int year, int week, int date)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmMaterialreturn>()
|
||||
.AndIF(year > 0, it => it.Year == year)
|
||||
.AndIF(week > 0, it => it.Week == week)
|
||||
.AndIF(date > 0, it => it.Date == date)
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
|
||||
List<WmMaterialreturn> materialreturnsList = Context.Queryable<WmMaterialreturn>().Where(predicate).OrderBy(it => it.Id).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (materialreturnsList, totalCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
ZR.Service/mes/wms/IService/IWMWarehousingService.cs
Normal file
22
ZR.Service/mes/wms/IService/IWMWarehousingService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
21
ZR.Service/mes/wms/IService/IWMlocationInfoService.cs
Normal file
21
ZR.Service/mes/wms/IService/IWMlocationInfoService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
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 IWMlocationInfoService
|
||||
{
|
||||
|
||||
|
||||
// 获取成品库信息
|
||||
public (List<WmInfo>,int) Getwminfo_product(string shelf , int layer, int pageNum , int pageSize);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
28
ZR.Service/mes/wms/WMentryWarehousing_productService.cs
Normal file
28
ZR.Service/mes/wms/WMentryWarehousing_productService.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
[AppService(ServiceType = typeof(IWMentryWarehousing_productService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMentryWarehousing_productService : BaseService<WmInfo>, IWMentryWarehousing_productService
|
||||
{
|
||||
bool IWMentryWarehousing_productService.IsProductionLoacation(string production_location_code)
|
||||
{
|
||||
|
||||
return Context.Queryable<WmInfo>().Where(it => it.WarehouseNum == 1)
|
||||
.Where(it => it.Location.Equals(production_location_code)).Any();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
41
ZR.Service/mes/wms/WMlocationInfoService.cs
Normal file
41
ZR.Service/mes/wms/WMlocationInfoService.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
using ZR.Service.mes.wms.IService;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
[AppService(ServiceType = typeof(IWMlocationInfoService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WMlocationInfoService : BaseService<WmInfo>, IWMlocationInfoService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取成品库库位信息
|
||||
/// </summary>
|
||||
/// <param name="shelf"></param>
|
||||
/// <param name="layer"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public (List<WmInfo>, int) Getwminfo_product(string shelf, int layer, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<WmInfo>()
|
||||
.AndIF(!string.IsNullOrEmpty(shelf), it => it.Shelf == shelf)
|
||||
.AndIF(layer > 0, it => it.Layer == layer)
|
||||
.ToExpression();
|
||||
List<WmInfo> product_wminfoList = Context.Queryable<WmInfo>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
|
||||
return (product_wminfoList, totalNum);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user