wangxinhui
2025-01-06 3a3f17f0890d721d97b139f88dde7df5c13ba688
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -25,6 +25,7 @@
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.ERP;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.MES;
using WIDESEA_External.ERPService;
using WIDESEA_External.Model;
using WIDESEA_IBasicRepository;
@@ -35,6 +36,7 @@
using WIDESEA_IStockRepository;
using WIDESEA_IStockService;
using WIDESEA_ITaskInfoRepository;
using WIDESEA_ITaskInfoService;
using WIDESEA_Model.Models;
using WIDESEA_StockRepository;
@@ -215,6 +217,7 @@
                    SerialNumber = model.SerialNumber,
                    StockQuantity = model.Quantity,
                    OutboundQuantity = 0,
                    Unit = materielInfo.MaterielUnit,
                    Status = StockStatusEmun.组盘暂存.ObjToInt(),
                    ProductionDate = model.ProductionDate,
                    EffectiveDate = model.EffectiveDate,
@@ -270,7 +273,7 @@
                {
                    return WebResponseContent.Instance.Error($"未找到该仓库信息");
                }
                Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.InboundOrderNo == orderNo && x.WarehouseId == warehouse.WarehouseId).Includes(x => x.Details).First();
                if (inboundOrder == null)
                {
@@ -344,6 +347,14 @@
                if (warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
                {
                    stockInfo.Remark = Initiallife.ToString();
                    if (palletCode.Substring(0, 1) == "6")
                    {
                        stockInfo.PalletType = PalletTypeEnum.MediumPallet.ObjToInt();
                    }
                    else
                    {
                        stockInfo.PalletType = PalletTypeEnum.LargestPallet.ObjToInt();
                    }
                }
                List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
@@ -371,6 +382,7 @@
                        SerialNumber = model.SerialNumber,
                        StockQuantity = model.Quantity,
                        OutboundQuantity = 0,
                        Unit = materielInfo.MaterielUnit,
                        Status = StockStatusEmun.组盘暂存.ObjToInt(),
                        ProductionDate = model.ProductionDate,
                        EffectiveDate = model.EffectiveDate,
@@ -406,6 +418,14 @@
                _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder);
                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup);
                _unitOfWorkManage.CommitTran();
                //if (warehouse.WarehouseCode==WarehouseEnum.HA153.ToString())
                //{
                //    //同步测试架信息
                //    foreach (var model in models)
                //    {
                //        _taskService.TestSynStock(new TestToolSynInfo() { ToolCode = model.LotNo, Life = Initiallife });
                //    }
                //}
                content.OK();
            }
            catch (Exception ex)
@@ -467,6 +487,14 @@
                if (warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())
                {
                    stockInfo.Remark = Initiallife.ToString();
                    if (palletCode.Substring(0, 1) == "6")
                    {
                        stockInfo.PalletType = PalletTypeEnum.MediumPallet.ObjToInt();
                    }
                    else
                    {
                        stockInfo.PalletType = PalletTypeEnum.LargestPallet.ObjToInt();
                    }
                }
                List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>();
@@ -482,6 +510,7 @@
                        SerialNumber = model.SerialNumber,
                        StockQuantity = model.Quantity,
                        OutboundQuantity = 0,
                        Unit= materielInfo.MaterielUnit,
                        Status = StockStatusEmun.组盘暂存.ObjToInt(),
                        ProductionDate = model.ProductionDate,
                        EffectiveDate = model.EffectiveDate,
@@ -510,6 +539,11 @@
                }
                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup);
                _unitOfWorkManage.CommitTran();
                //同步测试架信息
                //foreach (var model in models)
                //{
                //    _taskService.TestSynStock(new TestToolSynInfo() { ToolCode = model.LotNo, Life = Initiallife });
                //}
                content.OK();
            }
            catch (Exception ex)
@@ -557,16 +591,8 @@
                    Way = 1,
                    Details = detailModels
                };
                string response = _invokeERPService.InvokeInboundOrderApi(model);
                ErpRequestContent? requestContent = JsonConvert.DeserializeObject<ErpRequestContent>(response);
                if (requestContent == null)
                {
                    return WebResponseContent.Instance.Error();
                }
                if (requestContent.res == 0)
                {
                    return WebResponseContent.Instance.Error(requestContent.Data);
                }
                //推送ERP æµ‹è¯•注释
                _invokeERPService.InvokeInboundOrderApi(model);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
@@ -649,7 +675,8 @@
                    Way = 1,
                    Details = detailModels
                };
                string response = _invokeERPService.InvokeInboundOrderApi(model);
                //测试注释
                _invokeERPService.InvokeInboundOrderApi(model);
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)