wangxinhui
2025-03-15 efaf0b8aeb26aca6536a4b384c912cc3cac4d070
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -2,8 +2,10 @@
using HslCommunication.WebSocket;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using SqlSugar;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
@@ -41,6 +43,7 @@
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_StockRepository;
using static Org.BouncyCastle.Pqc.Crypto.Utilities.PqcOtherInfoGenerator;
namespace WIDESEA_InboundService
{
@@ -556,7 +559,7 @@
                    }
                    else
                    {
                        FeedbackInboundOrder(inboundOrder);
                        FeedbackInboundOrder(inboundOrder.Id);
                    }
                }
                #endregion
@@ -1131,11 +1134,12 @@
        /// 鍏ュ簱瀹屾垚涓婃姤ERP
        /// </summary>
        /// <returns></returns>
        public WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder)
        public WebResponseContent FeedbackInboundOrder(int inboundOrderId)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == inboundOrderId).Includes(x => x.Details).First();
                if (inboundOrder.Details.Count == 0)
                {
                    return WebResponseContent.Instance.Error($"鏈壘鍒板叆搴撳崟鏄庣粏淇℃伅");
@@ -1232,11 +1236,11 @@
                        .Select(mg => new ReturnPickItem
                        {
                            Material = mg.Key,
                            Qty = mg.Sum(x => x.Qty),
                            Qty = mg.Sum(x => x.ReturnQty),
                            Dataitem = mg.Select(d => new ReturnDataItem
                            {
                                Lotno = d.BatchNo,
                                Qty = d.Qty,
                                Qty = d.ReturnQty,
                                Location = warehouse.WarehouseCode,
                                Msfpart = d.Code
                            }).ToList()
@@ -1263,6 +1267,61 @@
            }
            return content;
        }
        /// <summary>
        /// 鎴愬搧鍏ュ簱涓婁紶ERP
        /// </summary>
        public WebResponseContent FeedbackProIn(Dt_MesProInOrder mesProInOrder)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                List<ERPProItemsItem> proItemsItems = new List<ERPProItemsItem>();
                foreach (var item in mesProInOrder.Details)
                {
                    ERPProItemsItem proItemsItem = new ERPProItemsItem()
                    {
                        PartNum = item.ProductCode,
                        Rev=item.ProductVersion,
                        DateCode=item.DateCode,
                        BatchNumber= item.BagNo,
                        XLocation=item.XSite,
                        Xqty=item.XQty,
                        QtySet=item.SETQty,
                        QtyPcs=item.OKPCSQTY,
                        WoList=new List<ERPProListItem>()
                        {
                            new ERPProListItem()
                            {
                                moNumber=item.MoNumber,
                                WoNumber=item.ERPOrder,
                                QtyPcs=item.OKPCSQTY,
                                QtySet=item.SETQty
                            }
                        }
                    };
                    proItemsItems.Add(proItemsItem);
                }
                ERPProInboundModel proInboundModel = new ERPProInboundModel()
                {
                    Way = 1,
                    Code = mesProInOrder.ProInOrderNo,
                    CreatorCode = "GSWMS",
                    CompanyCode = "HATC",
                    FactoryCode = "HA02",
                    WarehouseCode = "HA71",
                    LocationCode = "HA71",
                    StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    StockFormType= "Production",
                    StockFormItems= proItemsItems
                };
                _invokeERPService.InvokeProInApi(proInboundModel);
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            return content;
        }
        static object lock_code = new object();
        public string CreateCodeByRule(string ruleCode)
        {