1
This commit is contained in:
@ -12,6 +12,7 @@ using WCS.BLL.Tool.Api.ApiModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.InOutRecord;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
@ -439,7 +440,7 @@ namespace WCS.BLL.Services.Service
|
||||
ior.MatSupplier = matSnListDetail.MatSupplier;
|
||||
ior.StoreCode = request.ShelfCode;
|
||||
ior.StoreId = SI[0].Id;
|
||||
ior.Direction = 0;
|
||||
ior.Direction = DirectionEnum.入库;
|
||||
ior.OperateTime = DateTime.Now;
|
||||
ior.OperateUser = request.UserName;
|
||||
int count1 = DbHelp.db.Insertable(ior).ExecuteCommand();
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Sockets;
|
||||
@ -12,6 +13,7 @@ using WCS.BLL.Services.IService;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.InOutRecord;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
@ -551,7 +553,31 @@ namespace WCS.BLL.Services.Service
|
||||
order.OutOrderExeStatus = OutOrderExeStatus.开始发料;
|
||||
DbHelp.db.Updateable(order).ExecuteCommand();
|
||||
}
|
||||
//返回需求明细
|
||||
//获取亮灯颜色
|
||||
List<string> UsedColor = new List<string>();
|
||||
string LightColor = "";
|
||||
List<OrderLight> ol = DbHelp.db.Queryable<OrderLight>().OrderBy(it => it.Id, OrderByType.Asc).ToList();
|
||||
foreach (OrderLight orderLight in ol)
|
||||
{
|
||||
UsedColor.Add(orderLight.LightColor);
|
||||
if (orderLight.OrderNumber == request.OrderNumber)
|
||||
{
|
||||
LightColor = orderLight.LightColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (LightColor == "")
|
||||
{
|
||||
foreach (OrderLight orderLight in ol)
|
||||
{
|
||||
if (orderLight.OrderNumber == null)
|
||||
{
|
||||
LightColor = orderLight.LightColor;
|
||||
DbHelp.db.Updateable<OrderLight>().SetColumns(it => it.OrderNumber, request.OrderNumber).Where(it => it.LightColor == LightColor).ExecuteCommand();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取出库需求
|
||||
List<OutOrderDetail> outorderdetal = DbHelp.db.Queryable<OutOrderDetail>()
|
||||
.WhereIF(request.OrderId != 0, t => t.OrderId == request.OrderId)
|
||||
@ -564,17 +590,18 @@ namespace WCS.BLL.Services.Service
|
||||
{
|
||||
OutDetail od = new OutDetail();
|
||||
od.OrderId = outdetail.OrderId;
|
||||
od.OrderNumber= outdetail.OrderNumber;
|
||||
od.MatCode=outdetail.MatCode;
|
||||
od.MatBatch=outdetail.MatBatch;
|
||||
od.OrderNumber = outdetail.OrderNumber;
|
||||
od.MatCode = outdetail.MatCode;
|
||||
od.MatBatch = outdetail.MatBatch;
|
||||
od.ReqQty = outdetail.ReqQty;
|
||||
od.CreateTime = outdetail.CreateTime;
|
||||
od.CreateUser = outdetail.CreateUser;
|
||||
od.MatName = outdetail.MatName;
|
||||
od.OutQty = outdetail.OutQty;
|
||||
od.LightColor = "";
|
||||
od.LightColor = LightColor;
|
||||
orcs.Data.Add(od);
|
||||
}
|
||||
//亮灯
|
||||
|
||||
//返回
|
||||
return new OutResponseCommonSingle()
|
||||
@ -619,7 +646,7 @@ namespace WCS.BLL.Services.Service
|
||||
.WhereIF(!string.IsNullOrEmpty(outOrderDetail.MatBatch), t => t.MatBatch == outOrderDetail.MatBatch)
|
||||
.Where(t => t.IsLocked == false)//未锁定的物料
|
||||
.OrderBy(t => t.MatBatch)//先进先出
|
||||
//(t => t.MatQty)//零散料先出
|
||||
//(t => t.MatQty)//零散料先出
|
||||
.ToList();
|
||||
|
||||
//2.2按照搜索出来的库存和当前未出的数量 计算需要出的SN
|
||||
@ -804,5 +831,100 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> GoOutOutstoreSingle(GetOutOrderDetailRequest request)
|
||||
{
|
||||
|
||||
//获取出库单
|
||||
var order = await DbHelp.db.Queryable<OutOrder>()
|
||||
.WhereIF(request.OrderId != 0, t => t.Id == request.OrderId)
|
||||
.WhereIF(!string.IsNullOrEmpty(request.OrderNumber), t => t.OrderNumber == request.OrderNumber)
|
||||
.FirstAsync();
|
||||
if (order == null)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"不存在对应的出库单据{request.OrderNumber}!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
//判断出库状态
|
||||
bool isComplete = true;
|
||||
List<OutOrderDetail> ood = DbHelp.db.Queryable<OutOrderDetail>().Where(it => it.OrderNumber == request.OrderNumber).ToList();
|
||||
foreach (OutOrderDetail detail in ood)
|
||||
{
|
||||
if (detail.ReqQty > detail.OutQty)
|
||||
{
|
||||
isComplete = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isComplete == false)
|
||||
{
|
||||
order.OutOrderExeStatus = OutOrderExeStatus.暂停发料;
|
||||
DbHelp.db.Updateable(order).ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
order.OutOrderExeStatus = OutOrderExeStatus.发料完成;
|
||||
DbHelp.db.Updateable(order).ExecuteCommand();
|
||||
}
|
||||
DbHelp.db.Updateable<OrderLight>().SetColumns(it => it.OrderNumber == null).Where(it => it.OrderNumber == request.OrderNumber).ExecuteCommand();
|
||||
//灭灯
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success",
|
||||
Data = null
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> SingleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
|
||||
{
|
||||
InOutRecord ior = new InOutRecord();
|
||||
List<InventoryDetail> id = DbHelp.db.Queryable<InventoryDetail>().Where(it => it.MatSN == request.MatSn).ToList();
|
||||
if (id.Count == 0)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"此SN不在库存中{request.MatSn}!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
ior.StoreId = id[0].StoreId;
|
||||
ior.StoreCode = id[0].StoreCode;
|
||||
ior.MatSN = request.MatSn;
|
||||
ior.MatCode = request.MatCode;
|
||||
ior.MatName = request.MatName;
|
||||
ior.MatSpec = request.MatSpec;
|
||||
ior.MatBatch = request.MatBatch;
|
||||
ior.MatQty = request.Qty;
|
||||
ior.MatSupplier = request.MatSupplier;
|
||||
ior.MatCustomer = request.MatCustomer;
|
||||
ior.OrderNumber = request.orderNumber;
|
||||
ior.Direction = DirectionEnum.出库;
|
||||
ior.OperateUser = request.userName;
|
||||
ior.OperateTime = DateTime.Now;
|
||||
//保存出库记录
|
||||
int count= DbHelp.db.Insertable(ior).ExecuteCommand();
|
||||
//删除库存
|
||||
DbHelp.db.Deleteable<InventoryDetail>().Where(it => it.MatSN == request.MatSn).ExecuteCommand();
|
||||
//更新需求表
|
||||
List<OutOrderDetail> odd = DbHelp.db.Queryable<OutOrderDetail>().Where(it => it.OrderNumber == request.orderNumber).Where(it=>it.MatCode==request.MatCode).ToList();
|
||||
odd[0].OutQty += request.Qty;
|
||||
DbHelp.db.Updateable(odd[0]).ExecuteCommand();
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"出库成功",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user