From a0a0df2e824b6fe7e5a3c0afce78127fecf84fc9 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 03 十一月 2025 08:23:05 +0800
Subject: [PATCH] ERP接口代码更新,WCS代码优化,出入库分配优化
---
项目代码/WMS/WMSServices/WIDESEA_BasicService/CustomerInfoService.cs | 96 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/CustomerInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/CustomerInfoService.cs"
new file mode 100644
index 0000000..a1ed488
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/CustomerInfoService.cs"
@@ -0,0 +1,96 @@
+锘縰sing AutoMapper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_BasicRepository;
+using WIDESEA_Common.MaterielEnum;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Helper;
+using WIDESEA_DTO.Basic;
+using WIDESEA_DTO.ERP;
+using WIDESEA_IBasicRepository;
+using WIDESEA_IBasicService;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_BasicService
+{
+ public class CustomerInfoService : ServiceBase<Dt_CustomerInfo, ICustomerInfoRepository>, ICustomerInfoService
+ {
+ public ICustomerInfoRepository Repository => BaseDal;
+ private readonly IMapper _mapper;
+ private readonly IUnitOfWorkManage _unitOfWorkManage;
+ public CustomerInfoService(ICustomerInfoRepository BaseDal,IMapper mapper,IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
+ {
+ _mapper = mapper;
+ _unitOfWorkManage = unitOfWorkManage;
+ }
+ /// <summary>
+ /// 鎺ユ敹浜屾湡瀹㈡埛淇℃伅
+ /// </summary>
+ /// <param name="eRPCustomerDTO"></param>
+ /// <returns></returns>
+ public WebResponseContent ReceiveCustomer(ERPCustomerDTO eRPCustomerDTO)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ if (eRPCustomerDTO == null)
+ {
+ return content.Error("瀹㈡埛淇℃伅涓嶈兘浼犲叆涓虹┖");
+ }
+ List<Dt_CustomerInfo> OldcustomerInfos = BaseDal.QueryData();
+
+ if (eRPCustomerDTO.OperateType == 1)
+ {
+ //鍒ゆ柇閲嶅鎻掑叆
+ Dt_CustomerInfo? customerInfoOld = OldcustomerInfos.FirstOrDefault(x => x.CustomerCode == eRPCustomerDTO.CustomerCode);
+ if (customerInfoOld != null)
+ {
+ return content.Error($"瀹㈡埛{customerInfoOld.CustomerCode}宸插瓨鍦�");
+ }
+ Dt_CustomerInfo customerInfo = _mapper.Map<Dt_CustomerInfo>(eRPCustomerDTO);
+ //鏂板
+ BaseDal.AddData(customerInfo);
+ }
+ else if (eRPCustomerDTO.OperateType == 2)
+ {
+ //鍒ゆ柇鏄惁瀛樺湪
+ Dt_CustomerInfo? customerInfoOld = OldcustomerInfos.FirstOrDefault(x => x.CustomerCode == eRPCustomerDTO.CustomerCode);
+ if (customerInfoOld == null)
+ {
+ return content.Error($"鏇存柊瀹㈡埛{eRPCustomerDTO.CustomerCode}涓嶅瓨鍦�");
+ }
+ Dt_CustomerInfo customerInfo = _mapper.Map<Dt_CustomerInfo>(eRPCustomerDTO);
+ customerInfo.Id = customerInfoOld.Id;
+ //鏇存柊
+ BaseDal.UpdateData(customerInfoOld);
+ }
+ else if (eRPCustomerDTO.OperateType == 3)
+ {
+ // 鍒ゆ柇鏄惁瀛樺湪
+ Dt_CustomerInfo? customerInfoOld = OldcustomerInfos.FirstOrDefault(x => x.CustomerCode == eRPCustomerDTO.CustomerCode);
+ if (customerInfoOld == null)
+ {
+ return content.Error($"鏇存柊瀹㈡埛{eRPCustomerDTO.CustomerCode}涓嶅瓨鍦�");
+ }
+ BaseDal.DeleteData(customerInfoOld);
+ }
+ else
+ {
+ return content.Error("鏈壘鍒版搷浣滅被鍨�");
+ }
+ //鏇存柊鏁版嵁
+ return content.OK("鎺ユ敹鎴愬姛");
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ }
+}
--
Gitblit v1.9.3