1
This commit is contained in:
38
WCS.BLL/DbModels/OrderLight.cs
Normal file
38
WCS.BLL/DbModels/OrderLight.cs
Normal file
@ -0,0 +1,38 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WCS.BLL.DbModels
|
||||
{
|
||||
[SugarTable("order_light")]
|
||||
public class OrderLight
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键 自增Id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsNullable = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出库单据号
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "order_number", Length = 50, IsNullable = false, ColumnDescription = "出库单据号")]
|
||||
public string OrderNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单据执行状态: 待发料, 开始发料, 暂停发料, 发料完成
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "order_exe_status", IsNullable = true, ColumnDescription = "执行状态:\t待发料,\t开始发料,\t暂停发料,\t发料完成")]
|
||||
public OutOrderExeStatus OutOrderExeStatus { get; set; } = OutOrderExeStatus.待发料;
|
||||
|
||||
/// <summary>
|
||||
/// 单灯颜色
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "lightcolor", Length = 50, IsNullable = false, ColumnDescription = "单灯颜色")]
|
||||
public string LightColor { get; set; }
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WCS.BLL.Services.IService
|
||||
{
|
||||
@ -23,8 +24,12 @@ namespace WCS.BLL.Services.IService
|
||||
|
||||
public Task<ResponseBase> GoInOutstore(GetOutOrderDetailRequest request);
|
||||
|
||||
public Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request);
|
||||
|
||||
public Task<ResponseBase> GoInOutstoreSingle(GetOutOrderDetailRequest request);
|
||||
|
||||
public Task<ResponseBase> GoOutOutstore(GetOutOrderDetailRequest request);
|
||||
public Task<ResponseBase> SingleLightConfirmOutstore(OutOrderMatDetailModelSingle request);
|
||||
|
||||
public Task<ResponseBase> GoOutOutstoreSingle(GetOutOrderDetailRequest request);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
22
WCS.Model/ApiModel/OutStore/OutOrderMatDetailModelSingle.cs
Normal file
22
WCS.Model/ApiModel/OutStore/OutOrderMatDetailModelSingle.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.OutStore
|
||||
{
|
||||
public class OutOrderMatDetailModelSingle
|
||||
{
|
||||
public int orderId { get; set; }
|
||||
public string orderNumber { get; set; }
|
||||
public string MatSn { get; set; }
|
||||
public string MatCode { get; set; }
|
||||
public string MatName { get; set; }
|
||||
public string MatSpec { get; set; }
|
||||
public string MatBatch { get; set; }
|
||||
public int MatQty { get; set; }
|
||||
public string MatCustomer { get; set; }
|
||||
public string MatSupplier { get; set; }
|
||||
public int Qty { get; set; }
|
||||
public string userName { get; set; }
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
@ -252,7 +253,7 @@ namespace WebApi.Controllers
|
||||
//TODO<44><4F><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
return await _outstoreService.GoOutOutstore(request);
|
||||
return await _outstoreService.GoOutOutstoreSingle(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -271,12 +272,12 @@ namespace WebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[Route("singleLightConfirmOutstore")]
|
||||
[HttpPost(Name = "singleLightConfirmOutstore")]
|
||||
public async Task<ResponseBase> singleLightConfirmOutstore(GetOutOrderDetailRequest request)
|
||||
public async Task<ResponseBase> singleLightConfirmOutstore(OutOrderMatDetailModelSingle request)
|
||||
{
|
||||
//TODO<44><4F><EFBFBD><EFBFBD>
|
||||
try
|
||||
{
|
||||
return await _outstoreService.GoOutOutstore(request);
|
||||
return await _outstoreService.SingleLightConfirmOutstore(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user