From 441b6f8d257a01b2998253ef0515a201777d7e68 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 04 七月 2025 14:06:49 +0800
Subject: [PATCH] 修改入库、移库、出库逻辑
---
项目代码/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs | 86 ++++++++++++++++++++++++++++++++++++++++---
1 files changed, 80 insertions(+), 6 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
index ee6d793..00aaf40 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/Service/InboundOrderService.cs"
@@ -1,4 +1,5 @@
锘縰sing AutoMapper;
+using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -14,12 +15,14 @@
using WIDESEA_Core.Utilities;
using WIDESEA_DTO;
using WIDESEA_DTO.Inbound;
+using WIDESEA_DTO.WCSInfo;
using WIDESEA_IBasicService;
using WIDESEA_IInboundRepository;
using WIDESEA_IInboundService;
using WIDESEA_IStockService;
using WIDESEA_ITaskInfoRepository;
using WIDESEA_Model.Models;
+using WIDESEAWCS_DTO.WCSInfo;
namespace WIDESEA_InboundService
{
@@ -35,6 +38,64 @@
{
return BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == inboundOrderNo);
}
+ public bool UpdateDataWithDetail(Dt_InboundOrder inboundOrder)
+ {
+ return Db.UpdateNav(inboundOrder).Include(x => x.Details).ExecuteCommand();
+ }
+ /// <summary>
+ /// 绌烘墭缁勭洏鍏ュ簱
+ /// </summary>
+ /// <param name="materielGroupDTO"></param>
+ /// <returns></returns>
+ public WebResponseContent PdaAddEmptyStockInfo(string barcode, string station)
+ {
+ try
+ {
+ #region 娣诲姞涓�涓┖鎵樼粍鐩樹俊鎭強绌烘墭浠诲姟骞朵笅鍙戠粰WCS
+ Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(barcode);
+ if (stockInfo != null) throw new Exception($"鎵樼洏鍙枫�恵stockInfo.PalletCode}銆戝凡瀛樺湪缁勭洏淇℃伅");
+ Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == barcode && x.TaskType == TaskTypeEnum.PalletInbound.ObjToInt());
+ if (task == null)
+ {
+ task = new Dt_Task()
+ {
+ CurrentAddress = station,
+ NextAddress = "1001",
+ SourceAddress = station,
+ TargetAddress = "SC01",
+ Creater = "System",
+ PalletCode = barcode,
+ Roadway = "SC01",
+ OrderNo = DateTime.Now.ToString("yyMMdd"),
+ TaskNum = _taskRepository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
+ TaskState = InTaskStatusEnum.InNew.ObjToInt(),
+ TaskType = TaskTypeEnum.PalletInbound.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Dispatchertime = DateTime.Now,
+ };
+ Db.Ado.BeginTran();
+ WebResponseContent content = _stockService.StockInfoService.AddStockEmpty(barcode);
+ if (!content.Status) throw new Exception(content.Message);
+ _taskRepository.AddData(task);
+ List<WMSTaskDTO> wMSTaskDTOs = _mapper.Map<List<WMSTaskDTO>>(new List<Dt_Task> { task });
+ var ResultData = HttpHelper.PostAsync(WCSInterfaceAddress.ReceiveTask, wMSTaskDTOs.ToJson(), headers: new Dictionary<string, string>());
+ if (ResultData.Result == null) throw new Exception($"鍚慦CS涓嬪彂绌烘墭鍏ュ簱浠诲姟瓒呮椂");
+ content = JsonConvert.DeserializeObject<WebResponseContent>(ResultData.Result);
+ if (content == null) throw new Exception($"涓嬪彂绌烘墭鍏ュ簱浠诲姟WCS鏃犲搷搴�");
+ if (!content.Status) throw new Exception(content.Message);
+ Db.Ado.CommitTran();
+ }
+ else
+ throw new Exception($"鎵樼洏鍙枫�恵barcode}銆戝凡瀛樺湪浠诲姟");
+ #endregion
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ Db.Ado.RollbackTran();
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
/// <summary>
/// PDA缁勭洏
/// 鍗曠鐗╂枡缁勭洏
@@ -44,7 +105,6 @@
public WebResponseContent PdaAddStockInfo(PdaMaterielGroupDTO pdaMaterielGroupDTO)
{
WebResponseContent content = new WebResponseContent();
- WebResponseContent.Instance.OK();
try
{
Dt_MaterielInfo materielInfo = _basicService.MaterielInfoService.GetMaterielInfo(pdaMaterielGroupDTO.MaterielCode);
@@ -89,11 +149,11 @@
stockInfoDetail.StockQuantity += pdaMaterielGroupDTO.ReceiptQuantity;
stockInfoDetail.SerialNumber = $"{inboundOrder.OrderNo} | {materielInfo.MaterielCode} | {pdaMaterielGroupDTO.BatchNo} | {(int)stockInfoDetail.StockQuantity}";
}
-
+
Dt_InboundOrderDetail inboundOrderDetail = inboundOrder.Details.Where(x => materielInfo.MaterielCode == x.MaterielCode && x.BatchNo == pdaMaterielGroupDTO.BatchNo).FirstOrDefault();//璁㈠崟璇︽儏
- inboundOrderDetail.ReceiptQuantity += pdaMaterielGroupDTO.ReceiptQuantity;
+ inboundOrderDetail.ReceiptQuantity++;
inboundOrderDetail.OrderDetailStatus = inboundOrderDetail.OverInQuantity == inboundOrderDetail.OrderQuantity ? OrderDetailStatusEnum.Over.ObjToInt() : OrderDetailStatusEnum.GroupAndInbound.ObjToInt();
if (inboundOrder.Details.FirstOrDefault(x => x.OrderDetailStatus != OrderDetailStatusEnum.Over.ObjToInt()) == null)
@@ -238,6 +298,10 @@
{
return (false, "宸蹭笂鏋剁殑鎵樼洏涓嶈兘鍐嶆缁勭洏", materielGroupDTO);
}
+ if (stockInfo != null)
+ {
+ return (false, "宸茬粍鐩樼殑鎵樼洏涓嶈兘鍐嶆缁勭洏", materielGroupDTO);
+ }
if (materielInfo == null)
{
return (false, "鏈夌墿鏂欎俊鎭湭褰曞叆锛岃褰曞叆鐗╂枡淇℃伅", materielGroupDTO);
@@ -261,9 +325,10 @@
{
return (false, "鐗╂枡鎴栨壒娆″彿鏈夎", materielGroupDTO);
}
- if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < materielGroupDTO.ReceiptQuantity)
+ if (inboundOrderDetail.OrderQuantity - inboundOrderDetail.ReceiptQuantity < 1)
{
- return (false, "鏈夌墿鏂欒秴鍑哄崟鎹暟閲�", materielGroupDTO);
+ //return (false, "鏈夌墿鏂欒秴鍑哄崟鎹暟閲�", materielGroupDTO);
+ return (false, "缁勭洏瓒呭嚭鍗曟嵁鏁伴噺", materielGroupDTO);
}
return (true, "鎴愬姛", inboundOrderDetail);
}
@@ -360,7 +425,7 @@
}
else
{
- object obj = Repository.QueryPage(x => x.OrderNo == orderNo, pageNo, 10, new Dictionary<string, OrderByType> { { nameof(Dt_InboundOrder.CreateDate), OrderByType.Desc } }).Rows.Select(x => new
+ object obj = Repository.QueryPage(x => x.OrderNo.Contains(orderNo), pageNo, 10, new Dictionary<string, OrderByType> { { nameof(Dt_InboundOrder.CreateDate), OrderByType.Desc } }).Rows.Select(x => new
{
x.OrderNo,
x.UpperOrderNo,
@@ -370,5 +435,14 @@
return WebResponseContent.Instance.OK(data: obj);
}
}
+
+ public WebResponseContent QueryOrderDetailInfo(int pageNo, string orderNo)
+ {
+ WebResponseContent content = new WebResponseContent();
+ Dt_InboundOrder inboundOrder = GetInboundOrder(orderNo);
+ List<Dt_InboundOrderDetail> inboundOrderDetails = inboundOrder.Details;
+ content.OK(data: inboundOrderDetails);
+ return content;
+ }
}
}
--
Gitblit v1.9.3