From 3ca1401ff81f256f54533110b48c68e7fa6bfca5 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 01 十一月 2025 00:50:53 +0800
Subject: [PATCH] 整体流程代码优化
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs | 1
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs | 154 +++
新建文件夹/WIDESEA_WMSServer/ClassLibrary1/IMaterielInfoService.cs | 4
新建文件夹/WIDESEA_WMSServer/ClassLibrary2/EquipmentAlarmInforService.cs | 315 +++++--
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs | 1
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs | 4
新建文件夹/WIDESEA_WMSServer/ClassLibrary2/ContainerService.cs | 52 +
新建文件夹/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs | 9
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs | 119 +++
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/WMSInfo/MaterielInfoController.cs | 10
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs | 13
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs | 235 ++++-
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/MedicineGoodsController.cs | 5
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs | 426 +++++++---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs | 108 +
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IMedicineGoodsServices.cs | 4
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs | 91 ++
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs | 6
新建文件夹/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs | 2
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs | 227 -----
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json | 2
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs | 10
新建文件夹/WMS/src/extension/inbound/inboundOrder.js | 2
新建文件夹/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs | 276 +++++++
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs | 231 +++++
新建文件夹/WIDESEA_WMSServer/WIDESEA_WMSServer/AlarmJob.cs | 2
26 files changed, 1,727 insertions(+), 582 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/IMaterielInfoService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/IMaterielInfoService.cs"
index a0929c5..828afc2 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/IMaterielInfoService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/IMaterielInfoService.cs"
@@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Model.Models;
@@ -12,5 +13,8 @@
public interface IMaterielInfoService : IService<Dt_MaterielInfo>
{
IRepository<Dt_MaterielInfo> Repository { get; }
+
+ WebResponseContent GetMedicineGoodsInfom();
+ WebResponseContent ProductSynchronous();
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/ContainerService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/ContainerService.cs"
index 50f771e..bc1b6d0 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/ContainerService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/ContainerService.cs"
@@ -38,6 +38,58 @@
var url = "http://172.16.1.4:8082/api/environment/sensor";
var result = HttpHelper.Get(url);
var response = JsonConvert.DeserializeObject<CollResponse<CoolDto>>(result);
+ if (response == null || response.code != "000") throw new Exception("鎺ュ彛杩斿洖鏁版嵁鎶ラ敊");
+ var deviceNames = response.data.Select(x => x.name?.Trim()).Distinct().ToList();
+ var containers = BaseDal.QueryData(x => deviceNames.Contains(x.deviceName)).ToList();
+ List<Dt_Container> containersAdd = new List<Dt_Container>();
+ List<Dt_Container> containersUp = new List<Dt_Container>();
+ foreach (var item in response.data)
+ {
+ Dt_Container? container = containers.Where(x => x.deviceName == item.name).FirstOrDefault();
+ if (container == null)
+ {
+ container = new Dt_Container()
+ {
+ deviceName = item.name,
+ Alarm = item.alarm,
+ CurrentTemperature = item.temperature,
+ Humidity = item.humidity,
+ CreateDate = DateTime.Now,
+ AlarmInformation = item.message
+ };
+ containersAdd.Add(container);
+ }
+ else
+ {
+ container.Alarm = item.alarm;
+ container.CurrentTemperature = item.temperature;
+ container.Humidity = item.humidity;
+ container.AlarmInformation = item.message;
+ container.ModifyDate = DateTime.Now;
+ containersUp.Add(container);
+ }
+ if (item.alarm != "姝e父")
+ {
+ _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm,
+ $"鍐锋煖{item.alarm}", item.message, MessageStatusEnum.Undisposed);
+ }
+ }
+ if (containersAdd.Count > 0) BaseDal.AddData(containersAdd);
+ if (containersUp.Count > 0) BaseDal.UpdateData(containersUp);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+ public WebResponseContent Sensor1()
+ {
+ try
+ {
+ var url = "http://172.16.1.4:8082/api/environment/sensor";
+ var result = HttpHelper.Get(url);
+ var response = JsonConvert.DeserializeObject<CollResponse<CoolDto>>(result);
if (response.code != "000" || response.data == null)
{
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/EquipmentAlarmInforService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/EquipmentAlarmInforService.cs"
index 15afbf5..7d61267 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/EquipmentAlarmInforService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/EquipmentAlarmInforService.cs"
@@ -22,28 +22,111 @@
public class EquipmentAlarmInforService : ServiceBase<Dt_EquipmentAlarmInfor, IRepository<Dt_EquipmentAlarmInfor>>, IEquipmentAlarmInforService
{
private readonly IMessageInfoService _messageInfoService;
+ private readonly IUnitOfWorkManage _unitOfWorkManage;
- public EquipmentAlarmInforService(IRepository<Dt_EquipmentAlarmInfor> BaseDal, IMessageInfoService messageInfoService) : base(BaseDal)
+ public EquipmentAlarmInforService(IRepository<Dt_EquipmentAlarmInfor> BaseDal, IMessageInfoService messageInfoService, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
{
_messageInfoService = messageInfoService;
+ _unitOfWorkManage = unitOfWorkManage;
}
+ public WebResponseContent getDeviceStatus()
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var url = "http://172.16.1.2:8080/cube/taskInfo/getDeviceStatus?token=wH5zdAUCv2BEHJIinmowyki8cdc5ge8fAwFDcYZs0bVldNgmORt0O0l4GJTDv1dglRdMxb9xDK5Qb3NJAqL1Li2GkfdVa3KnIkfrQZtsP7UXhMmUz6xEuztG6d5svAJO9HENLb8JWVqCfpO2EWV6ebo/g5tJ9x7kbwwAxvCBrWdiEJv09FvaRQ== ";
+ var result = HttpHelper.Get(url);
+ var response = JsonConvert.DeserializeObject<AGVResponse<DeviceStatusData>>(result);
+ if (response == null || response.code != "0" || response.data == null) return content.Error($"鑾峰彇璁惧淇℃伅澶辫触: {response?.msg}");
+ List<string> codes = new List<string>();
+ if (response.data.robot.Count < 1 || response.data.sorters.Count < 0) return content.Error($"鑾峰彇璁惧淇℃伅涓虹┖: {response?.msg}");
+ // 澶勭悊鏈哄櫒浜鸿澶囨暟鎹�
+ codes.AddRange(response.data.robot.Select(x => x.robotCode).ToList());
+
+ // 澶勭悊鍒嗘嫞鍙拌澶囨暟鎹�
+ codes.AddRange(response.data.sorters.Select(x => x.sorterCode).ToList());
+
+ if (codes.Count < 1) return content;
+ List<Dt_EquipmentAlarmInfor> equipmentAlarmInfors = BaseDal.QueryData(x => codes.Contains(x.RobotCode));
+ List<Dt_EquipmentAlarmInfor> equipmentAlarmInforsAdd = new List<Dt_EquipmentAlarmInfor>();
+ List<Dt_EquipmentAlarmInfor> equipmentAlarmInforsUp = new List<Dt_EquipmentAlarmInfor>();
+ foreach (var item in response.data.robot)
+ {
+ Dt_EquipmentAlarmInfor? equipmentAlarmInfor = equipmentAlarmInfors.Where(x => x.RobotCode == item.robotCode).FirstOrDefault();
+ if (equipmentAlarmInfor == null)
+ {
+ equipmentAlarmInfor = new Dt_EquipmentAlarmInfor()
+ {
+ RobotCode = item.robotCode,
+ RobotName = item.robotName,
+ Status = item.status,
+ SyncTime = DateTime.Now,
+ CreateDate = DateTime.Now,
+ };
+ equipmentAlarmInforsAdd.Add(equipmentAlarmInfor);
+ }
+ else
+ {
+ equipmentAlarmInfor.RobotName = item.robotName;
+ equipmentAlarmInfor.Status = item.status;
+ equipmentAlarmInfor.SyncTime = DateTime.Now;
+ equipmentAlarmInforsUp.Add(equipmentAlarmInfor);
+ }
+ if (string.Equals(item.status, nameof(DeviceStatus.Error), StringComparison.OrdinalIgnoreCase))
+ {
+ _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, item.robotName, item.status);
+ }
+ }
+ foreach (var item in response.data.sorters)
+ {
+ Dt_EquipmentAlarmInfor? equipmentAlarmInfor = equipmentAlarmInfors.Where(x => x.RobotCode == item.sorterCode).FirstOrDefault();
+ if (equipmentAlarmInfor == null)
+ {
+ equipmentAlarmInfor = new Dt_EquipmentAlarmInfor()
+ {
+ RobotCode = item.sorterCode,
+ RobotName = item.sorterName,
+ Status = item.status,
+ SyncTime = DateTime.Now,
+ CreateDate = DateTime.Now,
+ };
+ equipmentAlarmInforsAdd.Add(equipmentAlarmInfor);
+ }
+ else
+ {
+ equipmentAlarmInfor.RobotName = item.sorterCode;
+ equipmentAlarmInfor.Status = item.status;
+ equipmentAlarmInfor.SyncTime = DateTime.Now;
+ equipmentAlarmInforsUp.Add(equipmentAlarmInfor);
+ }
+ if (string.Equals(item.status, nameof(DeviceStatus.Error), StringComparison.OrdinalIgnoreCase))
+ {
+ _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, item.sorterCode, item.status);
+ }
+ }
+ if (equipmentAlarmInforsAdd.Count > 0) BaseDal.AddData(equipmentAlarmInforsAdd);
+ if (equipmentAlarmInforsUp.Count > 0) BaseDal.UpdateData(equipmentAlarmInforsUp);
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
/// <summary>
/// 鏌ョ湅绔嬪簱灏忚溅鎶ヨ淇℃伅
/// </summary>
/// <returns></returns>
- public WebResponseContent getDeviceStatus()
+ public WebResponseContent getDeviceStatus1()
{
try
{
var url = "http://172.16.1.2:8080/cube/taskInfo/getDeviceStatus?token=wH5zdAUCv2BEHJIinmowyki8cdc5ge8fAwFDcYZs0bVldNgmORt0O0l4GJTDv1dglRdMxb9xDK5Qb3NJAqL1Li2GkfdVa3KnIkfrQZtsP7UXhMmUz6xEuztG6d5svAJO9HENLb8JWVqCfpO2EWV6ebo/g5tJ9x7kbwwAxvCBrWdiEJv09FvaRQ== ";
var result = HttpHelper.Get(url);
-
var response = JsonConvert.DeserializeObject<AGVResponse<DeviceStatusData>>(result);
-
-
// 妫�鏌ユ帴鍙e搷搴旀槸鍚︽垚鍔�
if (response == null || response.code != "0")
@@ -52,113 +135,86 @@
}
var syncTime = DateTime.Now;
- var saveCount = 0;
+ var AddEquipList = new List<Dt_EquipmentAlarmInfor>();
+ var UpdateEquipList = new List<Dt_EquipmentAlarmInfor>();
+ var alarmList = new List<(string deviceType, string deviceName, string deviceCode)>();
+
+ // 鏀堕泦鎵�鏈夎澶囩紪鐮侊紝涓�娆℃�ф煡璇�
+ var allDeviceCodes = new List<string>();
+ if (response.data?.robot != null && response.data.robot.Count > 0)
+ {
+ allDeviceCodes.AddRange(response.data.robot.Select(x => x.robotCode));
+ }
+ if (response.data?.sorters != null && response.data.sorters.Count > 0)
+ {
+ allDeviceCodes.AddRange(response.data.sorters.Select(x => x.sorterCode));
+ }
+
+ // 涓�娆℃�ф煡璇㈡墍鏈夊凡瀛樺湪鐨勮澶囪褰�
+ var existingRecords = allDeviceCodes.Any()
+ ? BaseDal.QueryData(x => allDeviceCodes.Contains(x.RobotCode))
+ .ToDictionary(x => x.RobotCode, x => x)
+ : new Dictionary<string, Dt_EquipmentAlarmInfor>();
// 澶勭悊鏈哄櫒浜鸿澶囨暟鎹�
- if (response.data?.robot != null && response.data.robot.Any())
+ if (response.data?.robot != null && response.data.robot.Count > 0)
{
foreach (var robot in response.data.robot)
{
- // 鏍规嵁璁惧缂栫爜鏌ヨ鏄惁瀛樺湪璁板綍
- var existingRecord = BaseDal.QueryData(x => x.RobotCode == robot.robotCode).FirstOrDefault();
-
- if (existingRecord == null)
- {
- // 鍒涘缓鏂拌褰�
- var newRecord = new Dt_EquipmentAlarmInfor
- {
- RobotName = robot.robotName,
- RobotCode = robot.robotCode,
- Status = robot.status,
- SyncTime = syncTime,
- CreateDate = syncTime,
- Creater = "System"
- };
- BaseDal.AddData(newRecord);
- if (robot.status == "error")
- {
- _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, "灏忚溅鍚嶇О:" + robot.robotName, $"灏忚溅缂栧彿銆恵robot.robotCode}銆戝彂鐢熼敊璇�", MessageStatusEnum.Emergency);
- }
- }
- else
- {
- // 鏇存柊鐜版湁璁板綍
- existingRecord.RobotName = robot.robotName;
- existingRecord.Status = robot.status;
- existingRecord.SyncTime = syncTime;
- existingRecord.ModifyDate = syncTime;
- existingRecord.Modifier = "System";
- BaseDal.UpdateData(existingRecord);
- if (robot.status == "error")
- {
- _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, "灏忚溅鍚嶇О:" + robot.robotName, $"灏忚溅缂栧彿銆恵robot.robotCode}銆戝彂鐢熼敊璇�", MessageStatusEnum.Emergency);
- }
- }
- saveCount++;
+ ProcessDevice(robot.robotCode, robot.robotName, robot.status, "鏈哄櫒浜�",
+ existingRecords, AddEquipList, UpdateEquipList, alarmList, syncTime);
}
}
// 澶勭悊鍒嗘嫞鍙拌澶囨暟鎹�
- if (response.data?.sorters != null && response.data.sorters.Any())
+ if (response.data?.sorters != null && response.data.sorters.Count > 0)
{
foreach (var sorter in response.data.sorters)
{
- // 鏍规嵁璁惧缂栫爜鏌ヨ鏄惁瀛樺湪璁板綍
- var existingRecord = BaseDal.QueryData(x => x.RobotCode == sorter.sorterCode).FirstOrDefault();
-
- if (existingRecord == null)
- {
- // 鍒涘缓鏂拌褰�
- var newRecord = new Dt_EquipmentAlarmInfor
- {
- RobotName = sorter.sorterName,
- RobotCode = sorter.sorterCode,
- Status = sorter.status,
- SyncTime = syncTime,
- CreateDate = syncTime,
- Creater = "System"
- };
- BaseDal.AddData(newRecord);
- if (sorter.status == "error")
- {
- _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, "鍒嗘嫞鍙板悕绉�:" + sorter.sorterName, $"缂栧彿銆恵sorter.sorterCode}銆戝彂鐢熼敊璇�", MessageStatusEnum.Emergency);
- }
- }
- else
- {
- // 鏇存柊鐜版湁璁板綍
- existingRecord.RobotName = sorter.sorterName;
- existingRecord.Status = sorter.status;
- existingRecord.SyncTime = syncTime;
- existingRecord.ModifyDate = syncTime;
- existingRecord.Modifier = "System";
- BaseDal.UpdateData(existingRecord);
- if (sorter.status == "error")
- {
- _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, "鍒嗘嫞鍙板悕绉�:" + sorter.sorterName, $"缂栧彿銆恵sorter.sorterCode}銆戝彂鐢熼敊璇�", MessageStatusEnum.Emergency);
- }
- }
- saveCount++;
+ ProcessDevice(sorter.sorterCode, sorter.sorterName, sorter.status, "鍒嗘嫞鍙�",
+ existingRecords, AddEquipList, UpdateEquipList, alarmList, syncTime);
}
}
- //// 杩斿洖鐘舵�佺粺璁′俊鎭�
- //var stateStats = response.data?.stateStatistics;
- //var statsInfo = stateStats != null ?
- // $"鍙敤:{stateStats.enable}, 鍏呯數:{stateStats.charging}, 涓嶅彲鐢�:{stateStats.disabled}, 閿欒:{stateStats.error}, 绂诲簱:{stateStats.down}, 鍗犵敤:{stateStats.occupied}"
- // : "鏃犵粺璁′俊鎭�";
-
- return new WebResponseContent
+ // 寮�鍚簨鍔�
+ //_unitOfWorkManage.BeginTran();
+ try
{
- Status = true,
- Message = $"鍚屾鎴愬姛锛屽叡澶勭悊 {saveCount} 鏉¤澶囪褰曘��"
- };
+ // 鎵归噺鎿嶄綔
+ if (AddEquipList.Count > 0)
+ {
+ BaseDal.AddData(AddEquipList);
+ }
+ if (UpdateEquipList.Count > 0)
+ {
+ BaseDal.UpdateData(UpdateEquipList);
+ }
+
+ // 鎻愪氦浜嬪姟
+ //_unitOfWorkManage.CommitTran();
+
+ // 澶勭悊鎶ヨ淇℃伅
+ ProcessAlarmMessages(alarmList);
+
+ var totalCount = AddEquipList.Count + UpdateEquipList.Count;
+ return new WebResponseContent
+ {
+ Status = true,
+ Message = $"鍚屾鎴愬姛锛屾柊澧� {AddEquipList.Count} 鏉★紝鏇存柊 {UpdateEquipList.Count} 鏉★紝鍏卞鐞� {totalCount} 鏉¤澶囪褰曘��"
+ };
+ }
+ catch (Exception ex)
+ {
+ //_unitOfWorkManage.RollbackTran();
+ return new WebResponseContent
+ {
+ Status = false,
+ Message = $"鏁版嵁淇濆瓨澶辫触: {ex.Message}"
+ };
+ }
}
catch (Exception ex)
{
- // 璁板綍璇︾粏閿欒鏃ュ織
- Console.WriteLine($"鑾峰彇璁惧鐘舵�佸紓甯�: {ex.Message}, StackTrace: {ex.StackTrace}");
-
return new WebResponseContent
{
Status = false,
@@ -166,5 +222,76 @@
};
}
}
+
+ /// <summary>
+ /// 澶勭悊鍗曚釜璁惧璁板綍
+ /// </summary>
+ private void ProcessDevice(string deviceCode, string deviceName, string status, string deviceType,
+ Dictionary<string, Dt_EquipmentAlarmInfor> existingRecords,
+ List<Dt_EquipmentAlarmInfor> addList,
+ List<Dt_EquipmentAlarmInfor> updateList,
+ List<(string deviceType, string deviceName, string deviceCode)> alarmList,
+ DateTime syncTime)
+ {
+ if (existingRecords.TryGetValue(deviceCode, out var existingRecord))
+ {
+ // 妫�鏌ョ姸鎬佹槸鍚﹀彂鐢熷彉鍖栵紝閬垮厤涓嶅繀瑕佺殑鏇存柊鍜岄噸澶嶆姤璀�
+ bool statusChanged = existingRecord.Status != status;
+
+ // 鏇存柊鐜版湁璁板綍
+ existingRecord.RobotName = deviceName;
+ existingRecord.Status = status;
+ existingRecord.SyncTime = syncTime;
+ existingRecord.ModifyDate = syncTime;
+ existingRecord.Modifier = "System";
+
+ updateList.Add(existingRecord);
+
+ // 鍙湁鐘舵�佸彉涓篹rror鏃舵墠鎶ヨ
+ if (statusChanged && status == "error")
+ {
+ alarmList.Add((deviceType, deviceName, deviceCode));
+ }
+ }
+ else
+ {
+ // 鍒涘缓鏂拌褰�
+ var newRecord = new Dt_EquipmentAlarmInfor
+ {
+ RobotName = deviceName,
+ RobotCode = deviceCode,
+ Status = status,
+ SyncTime = syncTime,
+ CreateDate = syncTime,
+ Creater = "System"
+ };
+ addList.Add(newRecord);
+
+ // 鏂拌澶囩姸鎬佷负error鏃舵姤璀�
+ if (status == "error")
+ {
+ alarmList.Add((deviceType, deviceName, deviceCode));
+ }
+ }
+ }
+
+ /// <summary>
+ /// 澶勭悊鎶ヨ淇℃伅
+ /// </summary>
+ private void ProcessAlarmMessages(List<(string deviceType, string deviceName, string deviceCode)> alarmList)
+ {
+ foreach (var alarm in alarmList)
+ {
+ string alarmTitle = alarm.deviceType == "鏈哄櫒浜�"
+ ? "灏忚溅鍚嶇О:" + alarm.deviceName
+ : "鍒嗘嫞鍙板悕绉�:" + alarm.deviceName;
+
+ string alarmMessage = alarm.deviceType == "鏈哄櫒浜�"
+ ? $"灏忚溅缂栧彿銆恵alarm.deviceCode}銆戝彂鐢熼敊璇�"
+ : $"缂栧彿銆恵alarm.deviceCode}銆戝彂鐢熼敊璇�";
+
+ _messageInfoService.AddMessageInfo(MessageGroupByEnum.EquipmentAlarm, alarmTitle, alarmMessage, MessageStatusEnum.Emergency);
+ }
+ }
}
-}
+}
\ No newline at end of file
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs"
index d7791bb..d7ddf51 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/MaterielInfoService.cs"
@@ -6,12 +6,14 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_IWMsInfoServices;
using WIDESEA_Model.Models;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
using static WIDESEA_DTO.SquareCabin.TowcsDto;
namespace WIDESEA_WMsInfoServices
@@ -22,6 +24,278 @@
{
}
public IRepository<Dt_MaterielInfo> Repository => BaseDal;
+
+
+ static string SearchDate = "2025-10-30 00:00:00";
+
+ /// <summary>
+ /// 鑾峰彇鑽搧鍩虹淇℃伅鍚屾鎺ュ彛
+ /// </summary>
+ /// <returns></returns>
+ public WebResponseContent GetMedicineGoodsInfom()
+ {
+ var responseContent = new WebResponseContent();
+ try
+ {
+
+ var url = "http://121.37.118.63:80/GYZ2/95fck/goodsInfo";
+ if (string.IsNullOrEmpty(SearchDate))
+ {
+ // 榛樿鏌ヨ杩囧幓24灏忔椂鐨勬暟鎹�
+ SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ }
+ // 璇锋眰鍙傛暟
+ var requestData = new
+ {
+ searchDate = SearchDate
+ };
+ SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ // 鍙戣捣璇锋眰
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+
+ // 鍙嶅簭鍒楀寲
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<MedicationsInfo>>(result);
+
+ if (response == null || response.resultCode != "0")
+ {
+ // 璋冪敤寮傚父鎺ュ彛
+ //SendErrorToUpstream(5, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
+ return responseContent.Error(response?.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
+ }
+ if (response.data.Count < 1)
+ {
+ return responseContent.OK("鏃犳柊鑽搧鏁版嵁");
+ }
+
+ var codes = response.data.Select(x => x.goods_no).ToList();
+
+ //鑾峰彇鎵�鏈夊凡瀛樺湪鐨勫晢鍝佺紪鍙�
+ var existingGoodsNos = BaseDal.QueryData(x => codes.Contains(x.MaterielCode)).Select(x => x.MaterielCode).ToList();
+
+ // 鏀堕泦鎵�鏈夎鎻掑叆鐨勫疄浣�
+ var entityList = response.data.Where(Medicat => !existingGoodsNos.Contains(Medicat.goods_no)).Select(Medicat => new Dt_MaterielInfo
+ {
+ MaterielCode = Medicat.goods_no,
+ MaterielErpType = Medicat.goods_type,
+ item = Medicat.goods_tym, //閫氱敤鍚�
+ MaterielName = Medicat.goods_spm,//鐗╂枡鍚嶇О
+ Dosage_form = GetDosageForm(Medicat.dosage_form),//鑽墏
+ Barcode = Medicat.barcode,//鏉″舰鍚�
+ MaterielSpec = Medicat.model,
+ Factory = Medicat.factory,
+ MaterielUnit = Medicat.unit,//鍗曚綅
+ MaterielSourceType = MaterielSourceTypeEnum.PurchasePart,
+ // 浣跨敤 ?? 杩愮畻绗︽彁渚涢粯璁ゅ��
+ MaterielLength = (float?)Medicat.item_length,
+ MaterielWide = (float?)Medicat.item_width,
+ MaterielHeight = (float?)Medicat.item_hight,
+ MaterielVolume = (float?)Medicat.item_volumn,
+ MaterielWeight = (float?)Medicat.item_weight,
+ MaterielStoragecondition = float.TryParse(Medicat.storage_confition, out var val) ? val : null, //鍌ㄥ瓨鏉′欢
+ Remark = Medicat.remark,
+ GoodStatusState = "鏈笅鍙�",
+ ModifyDate = Medicat.modify_date
+ }).ToList();
+ // 涓�娆℃�ф壒閲忔彃鍏ユ暟鎹簱
+ BaseDal.AddData(entityList);
+
+ //ProductSynchronous();
+ return responseContent.OK("鍚屾鎴愬姛");
+ }
+
+ catch (Exception ex)
+ {
+ Console.WriteLine("鑾峰彇ERP鐗╂枡淇℃伅寮傚父锛�" + ex.Message);
+ //SendErrorToUpstream(5, "", ex.Message, "");
+ return responseContent.Error(ex.Message);
+ }
+ }
+
+ /// <summary>
+ /// 鍒涘缓鑽墏瀛楀吀
+ /// </summary>
+ private static readonly Dictionary<string, string> _dosageFormMap = new Dictionary<string, string>
+ {
+ {"001", "鐗囧墏"}, {"002", "鐗囧墏"}, {"003", "鐗囧墏"}, {"004", "鐗囧墏"}, {"005", "鐗囧墏"},
+ {"006", "鐗囧墏"}, {"007", "鐗囧墏"}, {"008", "鐗囧墏"}, {"009", "鐗囧墏"}, {"010", "鐗囧墏"},
+ {"011", "鍏跺畠"}, {"012", "鐗囧墏"}, {"013", "鍏跺畠"}, {"014", "鐗囧墏"}, {"015", "鐗囧墏"},
+ {"016", "鐗囧墏"}, {"017", "鐗囧墏"}, {"018", "鍏跺畠"}, {"019", "鍏跺畠"}, {"020", "鍏跺畠"},
+ {"021", "閽堝墏"}, {"022", "閽堝墏"}, {"023", "閽堝墏"}, {"024", "閽堝墏"}, {"025", "涓垚鑽�"},
+ {"026", "涓垚鑽�"}, {"027", "鍏跺畠"}, {"028", "鍏跺畠"}, {"029", "鍏跺畠"}, {"030", "鍏跺畠"},
+ {"031", "鍏跺畠"}, {"032", "鍏跺畠"}, {"033", "鍏跺畠"}, {"034", "涓垚鑽�"}, {"035", "涓垚鑽�"},
+ {"036", "涓垚鑽�"}, {"037", "涓垚鑽�"}, {"038", "鍏跺畠"}, {"039", "鍏跺畠"}, {"040", "鍏跺畠"},
+ {"041", "涓垚鑽�"}, {"042", "涓垚鑽�"}, {"043", "涓垚鑽�"}, {"044", "鍏跺畠"}, {"045", "涓垚鑽�"},
+ {"046", "涓垚鑽�"}, {"047", "涓垚鑽�"}, {"048", "涓垚鑽�"}, {"049", "涓垚鑽�"}, {"050", "涓垚鑽�"},
+ {"051", "涓垚鑽�"}, {"052", "涓垚鑽�"}, {"053", "涓垚鑽�"}, {"054", "涓垚鑽�"}, {"055", "涓垚鑽�"},
+ {"056", "鍏跺畠"}, {"057", "鍏跺畠"}, {"058", "鍏跺畠"}, {"059", "鍏跺畠"}, {"060", "鍏跺畠"},
+ {"061", "鍏跺畠"}, {"062", "鍏跺畠"}, {"063", "鍏跺畠"}, {"064", "鍏跺畠"}, {"065", "鍏跺畠"},
+ {"066", "鍏跺畠"}, {"067", "涓垚鑽�"}, {"068", "涓垚鑽�"}, {"069", "涓垚鑽�"}, {"070", "鍏跺畠"},
+ {"071", "鍏跺畠"}, {"072", "鍏跺畠"}, {"073", "涓垚鑽�"}, {"074", "鍏跺畠"}, {"075", "鍏跺畠"},
+ {"076", "涓垚鑽�"}, {"077", "鍏跺畠"}, {"078", "鍏跺畠"}, {"079", "涓垚鑽�"}, {"080", "涓垚鑽�"},
+ {"081", "涓垚鑽�"}, {"082", "涓垚鑽�"}, {"083", "鍏跺畠"}, {"084", "涓垚鑽�"}, {"085", "鍏跺畠"},
+ {"086", "涓垚鑽�"}, {"087", "鍏跺畠"}, {"088", "鍏跺畠"}, {"089", "涓垚鑽�"}, {"090", "涓垚鑽�"},
+ {"091", "鍏跺畠"}, {"092", "鍏跺畠"}, {"093", "鍏跺畠"}, {"094", "涓垚鑽�"}, {"095", "鍏跺畠"},
+ {"096", "鍏跺畠"}, {"097", "鍏跺畠"}, {"098", "鍏跺畠"}, {"099", "鍏跺畠"}, {"100", "鍏跺畠"},
+ {"101", "鍏跺畠"}, {"102", "鍏跺畠"}, {"103", "鍏跺畠"}, {"104", "鍏跺畠"}, {"105", "鍏跺畠"},
+ {"106", "鍏跺畠"}, {"107", "鍏跺畠"}, {"108", "鍏跺畠"}, {"109", "鍏跺畠"}, {"110", "鍏跺畠"},
+ {"111", "鍏跺畠"}, {"112", "鍏跺畠"}, {"113", "鍏跺畠"}, {"114", "鍏跺畠"}, {"115", "鍏跺畠"},
+ {"116", "鍏跺畠"}, {"117", "鍏朵粬"}
+ };
+
+ /// <summary>
+ /// 鏍规嵁鍓傚瀷缂栧彿鑾峰彇鍓傚瀷鍒嗙被
+ /// </summary>
+ /// <param name="dosageCode">鍓傚瀷缂栧彿(001-117)</param>
+ /// <returns>鍓傚瀷鍒嗙被(鐗囧墏/閽堝墏/涓垚鑽�/鍏跺畠/鍏朵粬)</returns>
+ public static string GetDosageForm(string dosageCode)
+ {
+ if (string.IsNullOrEmpty(dosageCode))
+ return "鏈煡";
+
+ // 澶勭悊缂栧彿鏍煎紡锛岀‘淇濇槸3浣嶆暟瀛�
+ if (dosageCode.Length == 1)
+ dosageCode = "00" + dosageCode;
+ else if (dosageCode.Length == 2)
+ dosageCode = "0" + dosageCode;
+
+ if (_dosageFormMap.TryGetValue(dosageCode, out string form))
+ {
+ return form;
+ }
+
+ return "鏈煡";
+ }
+ public WebResponseContent ProductSynchronous()
+ {
+ try
+ {
+ List<Dt_MaterielInfo> materielInfos = BaseDal.QueryData(x => x.MaterielSourceType == MaterielSourceTypeEnum.SelfMadePart && x.BoxQty > 0 && x.MinQty > 0 && x.GoodStatusState == "鏈笅鍙�").ToList();
+ if (materielInfos.Count < 1) return WebResponseContent.Instance.Error("鏃犳湭涓嬪彂鑽搧");
+ var url = "http://172.16.1.2:9357/file-admin/api/product/productSynchronous";
+ foreach (var item in materielInfos)
+ {
+ var medicineDTO = new ProductInfo
+ {
+ //鐢ㄦ埛code
+ customerCode = "905",
+ //鐗╂枡绫诲瀷
+ materialCode = item.MaterielErpType,
+ //浜у搧缂栫爜
+ productCode = item.MaterielCode,
+ //浜у搧鍚�
+ productName = item.MaterielName,
+ //浜у搧鏉$爜
+ productBarCode = item.Barcode,
+
+ //鑽墏
+ medicine = item.Dosage_form,//杩欓噷瑕佽皟鐢ㄦ柟娉曪紝杞寲鏂规硶
+
+ //瑙勬牸
+ productSpecifications = item.MaterielSpec,
+ //鍗曚綅
+ unit = item.MaterielUnit,
+ //闀�
+ singleProductLongNum = (item.MaterielLength ?? 0).ToString(),
+ //瀹�
+ singleProductWideNum = (item.MaterielWide ?? 0).ToString(),
+ //楂�
+ singleProductHighNum = (item.MaterielHeight ?? 0).ToString(),
+ //閲嶉噺
+ singleProductWeight = (item.MaterielWeight ?? 0).ToString(),
+ //浣撶Н
+ singleProductVolume = (item.MaterielVolume ?? 0).ToString(),
+ //鏄惁鍙栨秷 0鏄笉鍒犻櫎锛�1鍒犻櫎
+ isDelete = "0"
+ };
+ var result = HttpHelper.Post(url, medicineDTO.ToJsonString());
+ var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
+ if (resp != null && resp.code == "0") item.GoodStatusState = "涓嬪彂瀹屾垚";
+ }
+ BaseDal.UpdateData(materielInfos);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("涓嬪彂WCS鐗╂枡淇℃伅寮傚父锛�" + ex.Message);
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+ /// <summary>
+ /// 鍙戠粰涓嬫父wcs鍚屾鑽搧淇℃伅
+ /// </summary>
+ /// <returns></returns>
+ public WebResponseContent ProductSynchronous1()
+ {
+ try
+ {
+ //鎶婂皬浠舵湭涓嬪彂鐨勭殑淇℃伅鍜岀瑙勪负0锛屾渶浣庡簱瀛樹负0鐨勮繃婊ゆ帀
+ //var list = BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.GoodStatusState == "鏈笅鍙�" && x.MaterielSourceType == MaterielSourceTypeEnum.SelfMadePart).ToList();
+ var list = BaseDal.QueryData(x => x.MaterielSourceType == MaterielSourceTypeEnum.SelfMadePart && x.BoxQty > 0 && x.MinQty > 0 && x.GoodStatusState == "鏈笅鍙�").ToList();
+ if (list.Count < 1)
+ {
+ return new WebResponseContent().OK("鏃犳湭涓嬪彂鑽搧");
+ }
+ //鎵惧埌浜嗗氨灏嗘暣涓猯ist鍙戠粰涓嬫父绯荤粺
+ foreach (var item in list)
+ {
+ var medicineDTO = new ProductInfo
+ {
+ //鐢ㄦ埛code
+ customerCode = "905",
+ //鐗╂枡绫诲瀷
+ materialCode = item.MaterielErpType,
+ //浜у搧缂栫爜
+ productCode = item.MaterielCode,
+ //浜у搧鍚�
+ productName = item.MaterielName,
+ //浜у搧鏉$爜
+ productBarCode = item.Barcode,
+
+ //鑽墏
+ medicine = item.Dosage_form,//杩欓噷瑕佽皟鐢ㄦ柟娉曪紝杞寲鏂规硶
+
+ //瑙勬牸
+ productSpecifications = item.MaterielSpec,
+ //鍗曚綅
+ unit = item.MaterielUnit,
+ //闀�
+ singleProductLongNum = (item.MaterielLength ?? 0).ToString(),
+ //瀹�
+ singleProductWideNum = (item.MaterielWide ?? 0).ToString(),
+ //楂�
+ singleProductHighNum = (item.MaterielHeight ?? 0).ToString(),
+ //閲嶉噺
+ singleProductWeight = (item.MaterielWeight ?? 0).ToString(),
+ //浣撶Н
+ singleProductVolume = (item.MaterielVolume ?? 0).ToString(),
+ //鏄惁鍙栨秷 0鏄笉鍒犻櫎锛�1鍒犻櫎
+ isDelete = "0"
+ };
+ var url = "http://172.16.1.2:9357/file-admin/api/product/productSynchronous";
+ var result = HttpHelper.Post(url, medicineDTO.ToJsonString());
+ var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
+
+ if (resp != null && resp.code == "0")
+ {
+ item.GoodStatusState = "涓嬪彂瀹屾垚";
+ }
+ else
+ {
+ continue;
+ }
+
+ }
+ BaseDal.UpdateData(list);
+ //Db.Updateable(list).ExecuteCommand();
+ return new WebResponseContent { Status = true, Message = "鎴愬姛" };
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("ProductSynchronous 寮傚父锛�" + ex.Message);
+ return new WebResponseContent { Status = false, Message = ex.Message };
+ }
+
+ }
public override WebResponseContent DeleteData(object[] keys)
{
WebResponseContent content = new WebResponseContent();
@@ -85,7 +359,7 @@
saveModel.MainData.Add("goodStatusState", "鏈笅鍙�");
}
// 濡傛灉鐜板湪杩欎釜鐗╂枡淇℃伅鏄皬浠跺苟涓旂瑙勬垨鑰呮渶浣庡簱瀛樹负0锛岄偅涔堝氨瑕佹彁绀轰粬
- if (saveModel.MainData["materielSourceType"].ToString() == "SelfMadePart" && (saveModel.MainData["boxQty"].ToString() =="0"|| saveModel.MainData["minQty"].ToString()=="0"))
+ if (saveModel.MainData["materielSourceType"].ToString() == "SelfMadePart" && (saveModel.MainData["boxQty"].ToString() == "0" || saveModel.MainData["minQty"].ToString() == "0"))
{
// 杩欓噷娣诲姞浣犵殑閫昏緫
return WebResponseContent.Instance.Error("绠辫鍜屾渶灏忓簱瀛樻暟涓嶅彲宸蹭负0");
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs"
index c020a67..3d1bd41 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs"
@@ -21,7 +21,7 @@
{
using HttpClient httpClient = new HttpClient();
httpClient.Timeout = new TimeSpan(0, 0, 60);
-
+
if (headers != null)
{
foreach (var header in headers)
@@ -105,6 +105,7 @@
{
string result = string.Empty;
DateTime beginDate = DateTime.Now;
+ string message = string.Empty;
try
{
using (HttpContent httpContent = new StringContent(requestJson))
@@ -125,11 +126,15 @@
}
catch (Exception e)
{
+ message = e.Message;
throw new Exception(e.Message);
}
finally
{
- Logger.Add(serviceAddress, requestJson, result, beginDate);
+ if (!string.IsNullOrEmpty(message))
+ Logger.Add(serviceAddress, requestJson, message, beginDate);
+ else
+ Logger.Add(serviceAddress, requestJson, result, beginDate);
}
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs"
index 05b83f0..dc1cb2b 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IBusiness.cs"
@@ -4,6 +4,8 @@
{
public interface IBusiness : IDependency
{
+ WebResponseContent GetInOrder();
+ WebResponseContent GetOutOrder();
/// <summary>
/// 鑾峰彇涓婃父鍏ュ簱璁㈠崟
/// </summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
index ded5aeb..204113b 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/ICabinOrderServices.cs"
@@ -25,5 +25,6 @@
/// <param name="key"></param>
/// <returns></returns>
WebResponseContent FinishInOrder(int key);
+ WebResponseContent CompleteLKInOrder(Dt_CabinOrder cabinOrder, TowcsDto.EdiOrderCallbackRequest request);
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
index acd20fc..c595243 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IDeliveryOrderServices.cs"
@@ -68,5 +68,6 @@
WebResponseContent CheckTaskFinish(Dt_SupplyTask supplyTask, string LocationCode = null);
WebResponseContent CreateOutboundOrder(OrderDto.UpstramOutOrderInfo upstramOutOrderInfo);
WebResponseContent CreateCheckOutOrder(OrderDto.UpstramOutOrderInfo outorder);
+ WebResponseContent CompleteLKOutOrder(Dt_DeliveryOrder deliveryOrder, TowcsDto.EdiOrderCallbackRequest request);
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IMedicineGoodsServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IMedicineGoodsServices.cs"
index 9c92ddf..9b23187 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IMedicineGoodsServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_ISquareCabinServices/IMedicineGoodsServices.cs"
@@ -16,9 +16,9 @@
/// 鑾峰彇鑽搧鍩虹淇℃伅鍚屾鎺ュ彛
/// </summary>
/// <returns></returns>
- public WebResponseContent GetMedicineGoodsInfom();
+ //public WebResponseContent GetMedicineGoodsInfom();
- public WebResponseContent ProductSynchronous();
+ //public WebResponseContent ProductSynchronous();
/// <summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
index c66b08c..7ce1d60 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/Business.cs"
@@ -17,24 +17,28 @@
using System.Xml.Linq;
using WIDESEA_Common.OrderEnum;
using static WIDESEA_DTO.SquareCabin.AlarmDto;
+using OfficeOpenXml.Style;
+using System.Security.Policy;
-namespace WIDESEA_WMSServer
+namespace WIDESEA_SquareCabinServices
{
- public class Business : IBusiness
+ public partial class Business : IBusiness
{
private readonly ICabinOrderServices _cabinOrderServices;
private readonly ICabinOrderDetailServices _cabinDetailServices;
private readonly IDeliveryOrderServices _deliveryOrderServices;
private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
+ private readonly IMaterielInfoService _materielInfoService;
private readonly IMessageInfoService _messageInfoService;
private readonly IUnitOfWorkManage _unitOfWorkManage;
- public Business(IDeliveryOrderServices deliveryOrderServices, IUnitOfWorkManage unitOfWorkManage, IDeliveryOrderDetailServices deliveryOrderDetailServices, ICabinOrderServices cabinOrderServices, ICabinOrderDetailServices cabinDetailServices, IMessageInfoService messageInfoService)
+ public Business(IDeliveryOrderServices deliveryOrderServices, IUnitOfWorkManage unitOfWorkManage, IDeliveryOrderDetailServices deliveryOrderDetailServices, ICabinOrderServices cabinOrderServices, ICabinOrderDetailServices cabinDetailServices, IMaterielInfoService materielInfoService, IMessageInfoService messageInfoService)
{
_deliveryOrderServices = deliveryOrderServices;
_unitOfWorkManage = unitOfWorkManage;
_deliveryOrderDetailServices = deliveryOrderDetailServices;
_cabinOrderServices = cabinOrderServices;
_cabinDetailServices = cabinDetailServices;
+ _materielInfoService = materielInfoService;
_messageInfoService = messageInfoService;
}
#region 鑾峰彇ERP鍏ュ簱鍗�
@@ -67,7 +71,7 @@
// 鍙嶅簭鍒楀寲
var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
- if (response == null || response.resultCode != "0" )
+ if (response == null || response.resultCode != "0")
{
// 璋冪敤寮傚父鎺ュ彛
//SendErrorToUpstream(1, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
@@ -111,7 +115,7 @@
if (!responseContent.Status) throw new Exception(responseContent.Message);
List<Dt_CabinOrder>? dt_CabinOrders = responseContent.Data as List<Dt_CabinOrder>;
if (dt_CabinOrders != null)
- _cabinOrderServices.Db.CopyNew().InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
+ _cabinOrderServices.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
}
else if (order.order_type == "3")//鍏ュ簱閫�鏂�
{
@@ -189,7 +193,7 @@
var result = HttpHelper.Post(url, requestData.ToJsonString());
var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result);
- if (response==null||response.resultCode != "0")
+ if (response == null || response.resultCode != "0")
{
//SendErrorToUpstream(3, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
return responseContent.Error(response?.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
@@ -296,44 +300,23 @@
{
try
{
- //2.鏌ヨ绗﹀悎鏉′欢鐨勮鍗曪紙琛ㄥご = 鏂板缓 && 鍖呭惈鏈夋晥鏄庣粏锛�
- //var orders = BaseDal.Db.Queryable<Dt_CabinOrder>()
- // .Where(o => o.OdrderStatus == "鏂板缓")
- // .Includes(o => o.Details, d => d.MedicineGoods)
- // .ToList();
- //鏌ュ嚭鍖呭惈鍏ㄩ儴鐨勫叆搴撳崟锛屽寘鍚叏閮ㄦ槑缁�+涓�涓槑缁嗗搴斾竴涓晢鍝�
var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
- var orders = _cabinOrderServices.Db.CopyNew()
- .Queryable<Dt_CabinOrder>()
- .Where(o => o.OdrderStatus == "鏂板缓" && o.Warehouse_no == reslut)
- .Includes(o => o.Details, d => d.MedicineGoods)
- .ToList();
- // 3. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0锛�
+ var orders = _cabinOrderServices.Repository.QueryData(x => x.OdrderStatus == "鏂板缓" && x.Warehouse_no == reslut);
+ if (orders.Count < 1) return WebResponseContent.Instance.OK();
+ string url = "http://172.16.1.2:9357/file-admin/api/in/ediIn";
+ var cabinOrderDetails = _cabinDetailServices.Repository.QueryData(x => orders.Select(x => x.Id).ToList().Contains(x.OrderId));
+ var materielInfos = _materielInfoService.Repository.QueryData(x => cabinOrderDetails.Select(x => x.Goods_no).Contains(x.MaterielCode));
foreach (var order in orders)
{
- //Console.WriteLine($"璁㈠崟 {order.Order_no} 鍘熸槑缁嗘暟锛歿order.Details.Count}");
- order.Details = order.Details.Where(d => d.Status == 0).ToList();
- //Console.WriteLine($"璁㈠崟 {order.Order_no} 杩囨护鍚庢槑缁嗘暟锛歿order.Details.Count}");
- }
-
-
- if (orders.Count < 1)
- {
- //Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
- return WebResponseContent.Instance.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
- }
-
- // 4. 閬嶅巻璁㈠崟锛岀粍瑁� DTO 骞舵帹閫�
- foreach (var order in orders)
- {
- // 浠庣涓�涓湁 MedicineGoods 鐨勬槑缁嗕腑鍙栧嚭 MaterielErpType
- string materialCode = order.Details
- .Select(d => d.MedicineGoods?.MaterielErpType)
- .FirstOrDefault(x => !string.IsNullOrEmpty(x)) ?? "YY"; // 榛樿鍊糦Y
-
+ order.Details = cabinOrderDetails.Where(x => x.OrderId == order.Id).ToList();
+ foreach (var item in order.Details)
+ {
+ item.MedicineGoods = materielInfos.Where(x => x.MaterielCode == item.Goods_no).First();
+ }
+ #region 涓嬪彂WCS
+ string materialCode = order.Details.FirstOrDefault()?.MedicineGoods?.MaterielErpType ?? "YY";
var ediDto = new ToediInInfo
{
-
//瀹㈡埛浠g爜
customerCode = "905",
//鐗╂枡绫诲瀷
@@ -353,62 +336,234 @@
//浜у搧
productCode = d.Goods_no,
//sku鍚嶇О
- productName = d.MedicineGoods?.MaterielName,
+ productName = d.MedicineGoods.MaterielName,
//sku瑙勬牸
- productSpecifications = d.MedicineGoods?.MaterielSpec,
+ productSpecifications = d.MedicineGoods.MaterielSpec,
//鏁伴噺
quantity = (int)d.Order_qty,
//鏁堟湡
validityPeriod = d.Exp_date,
//鐢熶骇鍘傚
- manufacturer = d.MedicineGoods?.Factory,
+ manufacturer = d.MedicineGoods.Factory,
//鎴垮彿
libraryNo = order.Warehouse_no,
}).ToList()
};
-
- var url = "http://172.16.1.2:9357/file-admin/api/in/ediIn";
- //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363019549";
var result = HttpHelper.Post(url, ediDto.ToJsonString());
var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
-
if (resp != null && resp.code == "0")
{
- // 鏇存柊琛ㄥご鐘舵��
- _cabinOrderServices.Db.Updateable<Dt_CabinOrder>()
- .SetColumns(o => new Dt_CabinOrder { OdrderStatus = "寮�濮�" })
- .Where(o => o.Id == order.Id)
- .ExecuteCommand();
-
- // 鏇存柊鏄庣粏鐘舵�佷负宸插悓姝� //杩欓噷瑕佹槸灏嗘柊寤�--銆嬪紑濮嬬姸鎬�,鍦ㄥ悗绔帴鍙h繑鍥炴垜浠殑鏃跺�欏湪杩斿洖宸插畬鎴�
- _cabinDetailServices.Db.Updateable<Dt_CabinOrderDetail>()
- .SetColumns(d => new Dt_CabinOrderDetail { Status = 1, OrderDetailStatus = "寮�濮�" })
- .Where(d => d.OrderId == order.Id && d.Status == 0)
- .ExecuteCommand();
-
- Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佹垚鍔�");
+ order.OdrderStatus = "寮�濮�";
+ foreach (var item in cabinOrderDetails.Where(x => x.OrderId == order.Id))
+ {
+ item.Status = 1;
+ item.OrderDetailStatus = "寮�濮�";
+ }
}
- else
- {
- continue;
- //SendErrorToUpstream(3, order.Order_no, resp?.msg ?? "WCS 鎺ㄩ�佸け璐�", "");
- //Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佸け璐ワ細{resp?.msg}");
- //return new WebResponseContent { Status = false, Message = "璁㈠崟鎺ㄩ�佸け璐�" };
- }
+ #endregion
}
- return new WebResponseContent { Status = true, Message = "鎺ㄩ�佹垚鍔�" };
+ _cabinOrderServices.UpdateData(orders);
+ _cabinDetailServices.UpdateData(cabinOrderDetails);
+ return WebResponseContent.Instance.OK();
}
catch (Exception ex)
{
-
- Console.WriteLine("EdiIn 寮傚父锛�" + ex.Message);
- return new WebResponseContent { Status = false, Message = ex.Message };
+ Console.WriteLine("涓嬪彂WCS鍏ュ簱鍗曞紓甯革細" + ex.Message);
+ return WebResponseContent.Instance.Error(ex.Message);
}
}
+ #region MyRegion
+
+ //public WebResponseContent EdiIn1()
+ //{
+ // try
+ // {
+ // //2.鏌ヨ绗﹀悎鏉′欢鐨勮鍗曪紙琛ㄥご = 鏂板缓 && 鍖呭惈鏈夋晥鏄庣粏锛�
+ // //var orders = BaseDal.Db.Queryable<Dt_CabinOrder>()
+ // // .Where(o => o.OdrderStatus == "鏂板缓")
+ // // .Includes(o => o.Details, d => d.MedicineGoods)
+ // // .ToList();
+ // //鏌ュ嚭鍖呭惈鍏ㄩ儴鐨勫叆搴撳崟锛屽寘鍚叏閮ㄦ槑缁�+涓�涓槑缁嗗搴斾竴涓晢鍝�
+ // var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
+ // var orders = _cabinOrderServices.Db.CopyNew()
+ // .Queryable<Dt_CabinOrder>()
+ // .Where(o => o.OdrderStatus == "鏂板缓" && o.Warehouse_no == reslut)
+ // .Includes(o => o.Details, d => d.MedicineGoods)
+ // .ToList();
+ // // 3. 鍐嶈繃婊ゆ帀涓嶇鍚堟潯浠剁殑鏄庣粏锛堝彧淇濈暀 Status=0锛�
+ // foreach (var order in orders)
+ // {
+ // //Console.WriteLine($"璁㈠崟 {order.Order_no} 鍘熸槑缁嗘暟锛歿order.Details.Count}");
+ // order.Details = order.Details.Where(d => d.Status == 0).ToList();
+ // //Console.WriteLine($"璁㈠崟 {order.Order_no} 杩囨护鍚庢槑缁嗘暟锛歿order.Details.Count}");
+ // }
+
+
+ // if (orders.Count < 1)
+ // {
+ // //Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
+ // return WebResponseContent.Instance.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
+ // }
+ // List<Dt_CabinOrderDetail> cabinOrderDetails = new List<Dt_CabinOrderDetail>();
+ // var url = "http://172.16.1.2:9357/file-admin/api/in/ediIn";
+ // // 4. 閬嶅巻璁㈠崟锛岀粍瑁� DTO 骞舵帹閫�
+ // foreach (var order in orders)
+ // {
+ // // 浠庣涓�涓湁 MedicineGoods 鐨勬槑缁嗕腑鍙栧嚭 MaterielErpType
+ // string materialCode = order.Details
+ // .Select(d => d.MedicineGoods?.MaterielErpType)
+ // .FirstOrDefault(x => !string.IsNullOrEmpty(x)) ?? "YY"; // 榛樿鍊糦Y
+
+ // var ediDto = new ToediInInfo
+ // {
+
+ // //瀹㈡埛浠g爜
+ // customerCode = "905",
+ // //鐗╂枡绫诲瀷
+ // materialCode = materialCode,
+ // //鍏ュ簱鍗曞彿
+ // externalOrderNo = order.Order_no,
+ // //鍏ュ簱鍗曠被鍨�
+ // inOrderType = order.Order_type == "5" ? "20" : "10",
+ // //浼樺厛绾�
+ // priority = 0,
+ // //鏄惁鍙栨秷
+ // Is_cancel = 0,
+ // details = order.Details.Select(d => new ToediInDetail
+ // {
+ // //鎵瑰彿
+ // batchNo = d.Batch_num,
+ // //浜у搧
+ // productCode = d.Goods_no,
+ // //sku鍚嶇О
+ // productName = d.MedicineGoods?.MaterielName,
+ // //sku瑙勬牸
+ // productSpecifications = d.MedicineGoods?.MaterielSpec,
+ // //鏁伴噺
+ // quantity = (int)d.Order_qty,
+ // //鏁堟湡
+ // validityPeriod = d.Exp_date,
+ // //鐢熶骇鍘傚
+ // manufacturer = d.MedicineGoods?.Factory,
+ // //鎴垮彿
+ // libraryNo = order.Warehouse_no,
+ // }).ToList()
+ // };
+
+ // //var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363019549";
+ // var result = HttpHelper.Post(url, ediDto.ToJsonString());
+ // var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
+
+ // if (resp != null && resp.code == "0")
+ // {
+ // order.OdrderStatus = "寮�濮�";
+ // foreach (var item in order.Details)
+ // {
+ // item.Status = 1;
+ // item.OrderDetailStatus = "寮�濮�";
+ // }
+ // cabinOrderDetails.AddRange(order.Details);
+ // // 鏇存柊琛ㄥご鐘舵��
+ // //_cabinOrderServices.Db.Updateable<Dt_CabinOrder>()
+ // // .SetColumns(o => new Dt_CabinOrder { OdrderStatus = "寮�濮�" })
+ // // .Where(o => o.Id == order.Id)
+ // // .ExecuteCommand();
+
+ // // 鏇存柊鏄庣粏鐘舵�佷负宸插悓姝� //杩欓噷瑕佹槸灏嗘柊寤�--銆嬪紑濮嬬姸鎬�,鍦ㄥ悗绔帴鍙h繑鍥炴垜浠殑鏃跺�欏湪杩斿洖宸插畬鎴�
+ // //_cabinDetailServices.Db.Updateable<Dt_CabinOrderDetail>()
+ // // .SetColumns(d => new Dt_CabinOrderDetail { Status = 1, OrderDetailStatus = "寮�濮�" })
+ // // .Where(d => d.OrderId == order.Id && d.Status == 0)
+ // // .ExecuteCommand();
+
+ // //Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佹垚鍔�");
+ // }
+ // else
+ // {
+ // continue;
+ // //SendErrorToUpstream(3, order.Order_no, resp?.msg ?? "WCS 鎺ㄩ�佸け璐�", "");
+ // //Console.WriteLine($"璁㈠崟 {order.Order_no} 鎺ㄩ�佸け璐ワ細{resp?.msg}");
+ // //return new WebResponseContent { Status = false, Message = "璁㈠崟鎺ㄩ�佸け璐�" };
+ // }
+ // }
+ // _cabinOrderServices.UpdateData(orders);
+ // _cabinDetailServices.UpdateData(cabinOrderDetails);
+ // return new WebResponseContent { Status = true, Message = "鎺ㄩ�佹垚鍔�" };
+ // }
+ // catch (Exception ex)
+ // {
+
+ // Console.WriteLine("EdiIn 寮傚父锛�" + ex.Message);
+ // return new WebResponseContent { Status = false, Message = ex.Message };
+ // }
+ //}
+ #endregion
#endregion
#region 涓嬪彂绔嬪簱鍑哄簱鍗�
public WebResponseContent EdiOut()
+ {
+ try
+ {
+ var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
+ var orders = _deliveryOrderServices.Repository.QueryData(x => x.OutStatus == "鏂板缓" && x.Warehouse_no == reslut);
+ if (orders.Count < 1) return WebResponseContent.Instance.OK();
+ string url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
+ var deliveryOrderDetails = _deliveryOrderDetailServices.Repository.QueryData(x => orders.Select(x => x.Id).ToList().Contains(x.DeliveryOrderId));
+ var materielInfos = _materielInfoService.Repository.QueryData(x => deliveryOrderDetails.Select(x => x.Goods_no).Contains(x.MaterielCode));
+ foreach (var order in orders)
+ {
+ order.Details = deliveryOrderDetails.Where(x => x.DeliveryOrderId == order.Id).ToList();
+ foreach (var item in order.Details)
+ {
+ item.MedicineGoods = materielInfos.Where(x => x.MaterielCode == item.Goods_no).First();
+ }
+ #region 涓嬪彂WCS
+ string materialCode = order.Details.FirstOrDefault()?.MedicineGoods?.MaterielErpType ?? "YY";
+ var ediDto = new ToediOutInfo
+ {
+ //瀹㈡埛浠g爜
+ customerCode = "905",
+ //鐗╂枡绫诲瀷
+ materialCode = materialCode,
+ externalOrderNo = order.Out_no,
+ outOrderType = order.Out_type,
+ priority = 1,
+ Is_cancel = 0,
+ details = order.Details.Select(d => new ToeOutdiInDetail
+ {
+ batchNo = d.Batch_num,
+ productCode = d.Goods_no,
+ productName = d.MedicineGoods.MaterielName,
+ productSpecifications = d.MedicineGoods.MaterielModel,
+ quantity = (int)d.Order_qty,
+ }).ToList()
+ };
+ var result = HttpHelper.Post(url, ediDto.ToJsonString());
+ var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
+ if (resp != null && resp.code == "0")
+ {
+ order.OutStatus = "寮�濮�";
+ foreach (var item in deliveryOrderDetails.Where(x => x.DeliveryOrderId == order.Id))
+ {
+ item.Status = 1;
+ item.OotDetailStatus = "寮�濮�";
+ }
+ }
+ #endregion
+ }
+ _deliveryOrderServices.UpdateData(orders);
+ _deliveryOrderDetailServices.UpdateData(deliveryOrderDetails);
+ return WebResponseContent.Instance.OK();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("涓嬪彂WCS鍑哄簱鍗曞紓甯革細" + ex.Message);
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
+ }
+
+ #region MyRegion
+ public WebResponseContent EdiOut1()
{
var responseContent = new WebResponseContent();
var WarehouseLk = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
@@ -431,7 +586,8 @@
//Console.WriteLine("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
return responseContent.Error("娌℃湁绗﹀悎鏉′欢鐨勮鍗曢渶瑕佹帹閫�");
}
-
+ List<Dt_DeliveryOrderDetail> deliveryOrderDetails = new List<Dt_DeliveryOrderDetail>();
+ var url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
foreach (var order in outOrders)
{
try
@@ -480,7 +636,6 @@
};
// 4. 璋冪敤鎺ュ彛
- var url = "http://172.16.1.2:9357/file-admin/api/out/ediOut";
//var url = "http://127.0.0.1:4523/m2/5660322-5340849-default/363076920";
var result = HttpHelper.Post(url, ediDto.ToJsonString());
@@ -488,18 +643,25 @@
if (resp != null && resp.code == "0")
{
+ order.OutStatus = "寮�濮�";
+ foreach (var item in order.Details)
+ {
+ item.Status = 1;
+ item.OotDetailStatus = "寮�濮�";
+ }
+ deliveryOrderDetails.AddRange(order.Details);
// 鏇存柊琛ㄥご鐘舵��
- _cabinDetailServices.Db.CopyNew().Updateable<Dt_DeliveryOrder>()
- .SetColumns(o => new Dt_DeliveryOrder { OutStatus = "寮�濮�" })
- .Where(o => o.Id == order.Id)
- .ExecuteCommand();
+ //_cabinDetailServices.Db.CopyNew().Updateable<Dt_DeliveryOrder>()
+ // .SetColumns(o => new Dt_DeliveryOrder { OutStatus = "寮�濮�" })
+ // .Where(o => o.Id == order.Id)
+ // .ExecuteCommand();
// 鏇存柊鏄庣粏鐘舵��
- _deliveryOrderDetailServices.Db.CopyNew().Updateable<Dt_DeliveryOrderDetail>()
- .SetColumns(d => new Dt_DeliveryOrderDetail { Status = 1, OotDetailStatus = "寮�濮�" })
- .Where(d => d.DeliveryOrderId == order.Id && d.Status == 0)
- .ExecuteCommand();
- Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佹垚鍔�");
+ //_deliveryOrderDetailServices.Db.CopyNew().Updateable<Dt_DeliveryOrderDetail>()
+ // .SetColumns(d => new Dt_DeliveryOrderDetail { Status = 1, OotDetailStatus = "寮�濮�" })
+ // .Where(d => d.DeliveryOrderId == order.Id && d.Status == 0)
+ // .ExecuteCommand();
+ //Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佹垚鍔�");
}
else
{
@@ -515,7 +677,8 @@
//Console.WriteLine($"璁㈠崟 {order.Out_no} 鎺ㄩ�佸紓甯革細{ex.Message}");
}
}
-
+ _deliveryOrderServices.UpdateData(outOrders);
+ _deliveryOrderDetailServices.UpdateData(deliveryOrderDetails);
return responseContent.OK("鍑哄簱璁㈠崟鎺ㄩ�佸畬鎴�");
}
catch (Exception ex)
@@ -524,6 +687,7 @@
return responseContent.Error("鍑哄簱璁㈠崟鎺ㄩ�佸け璐ワ細" + ex.Message);
}
}
+ #endregion
#endregion
#region 鍏ュ簱瀹屾垚涓婃姤ERP
@@ -537,66 +701,55 @@
var responseContent = new WebResponseContent();
try
{
- _unitOfWorkManage.BeginTran();
#region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍏ュ簱鍗�
var inorders = _cabinOrderServices.Repository.QueryData(x => x.OdrderStatus == "宸插畬鎴�").Select(x => x.Order_no).Distinct().ToList();
- foreach (var inorder in inorders)
+ var Orders = _cabinOrderServices.Db.Queryable<Dt_CabinOrder>().Where(x => inorders.Contains(x.Order_no)).Includes(x => x.Details).ToList();
+ List<Dt_CabinOrder> cabinOrders = new List<Dt_CabinOrder>();
+ List<Dt_CabinOrderDetail> cabinOrderDetails = new List<Dt_CabinOrderDetail>();
+ var url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";
+ foreach (var item in Orders.GroupBy(x => x.Order_no))
{
- var Orders = _cabinOrderServices.Db.CopyNew().Queryable<Dt_CabinOrder>().Where(x => x.Order_no == inorder).Includes(x => x.Details).ToList();
-
- if (!Orders.Where(x => x.OdrderStatus != "宸插畬鎴�").Any())
+ if (!item.Where(x => x.OdrderStatus != "宸插畬鎴�").Any())
{
- if (Orders.FirstOrDefault().Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString())
+ if (item.First().Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString())
{
- foreach (var item in Orders)
+ foreach (var a in item)
{
- if (item.Details != null)
- _cabinDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
- item.Details = null;
+ if (a.Details != null) cabinOrderDetails.AddRange(a.Details);
+ a.Details = null;
+ cabinOrders.Add(a);
}
- _cabinOrderServices.Repository.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
}
else
{
- // 璋冪敤涓婃父鎺ュ彛
- var url = "http://121.37.118.63:80/GYZ2/95fck/inOrderOk";
-
-
-
- var result = HttpHelper.Post(url, new { order_no = inorder }.ToJsonString());
+ var result = HttpHelper.Post(url, new { order_no = item.Key }.ToJsonString());
var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
- if (response != null&&response.resultCode == "0")
+ if (response != null && response.resultCode == "0")
{
- foreach (var item in Orders)
+ foreach (var a in item)
{
- if (item.Details != null)
- _cabinDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
- item.Details = null;
+ if (a.Details != null) cabinOrderDetails.AddRange(a.Details);
+ a.Details = null;
+ cabinOrders.Add(a);
}
- _cabinOrderServices.Repository.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
- // 鎻愪氦浜嬪姟
}
else
{
string mess = "涓婃姤ERP鏃犲搷搴�";
if (response != null) mess = response.resultMsg;
- _messageInfoService.AddMessageInfo(MessageGroupByEnum.InOrderAlarm, $"鍏ュ簱鍗曞彿銆恵inorder}銆戝畬鎴愪笂鎶RP澶辫触", mess);
- //_unitOfWorkManage.RollbackTran();
- //SendErrorToUpstream(2, "", $"涓婃父鎺ュ彛杩斿洖澶辫触: {response.resultMsg}", inorder);
+ _messageInfoService.AddMessageInfo(MessageGroupByEnum.InOrderAlarm, $"鍏ュ簱鍗曞彿銆恵item.Key}銆戝畬鎴愪笂鎶RP澶辫触", mess);
continue;
}
}
-
-
}
}
+ _cabinDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.鑷姩瀹屾垚);
+ _cabinOrderServices.Repository.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.鑷姩瀹屾垚);
#endregion
- _unitOfWorkManage.CommitTran();
return responseContent.OK();
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
return responseContent.Error("鎵归噺澶勭悊澶辫触锛�" + ex.Message);
}
}
@@ -613,63 +766,56 @@
var responseContent = new WebResponseContent();
try
{
- _unitOfWorkManage.BeginTran();
#region 鏌ユ壘鎵�鏈夊凡瀹屾垚鍑哄簱鍗�
var outorders = _deliveryOrderServices.Repository.QueryData(x => x.OutStatus == "宸插畬鎴�").Select(x => x.Out_no).Distinct().ToList();
- foreach (var outorder in outorders)
+ var Orders = _deliveryOrderServices.Db.Queryable<Dt_DeliveryOrder>().Where(x => outorders.Contains(x.Out_no)).Includes(x => x.Details).ToList();
+ List<Dt_DeliveryOrder> cabinOrders = new List<Dt_DeliveryOrder>();
+ List<Dt_DeliveryOrderDetail> cabinOrderDetails = new List<Dt_DeliveryOrderDetail>();
+ var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
+ foreach (var item in Orders.GroupBy(x => x.Out_no))
{
- var Orders = _deliveryOrderServices.Db.CopyNew().Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == outorder).Includes(x => x.Details).ToList();
-
- if (!Orders.Where(x => x.OutStatus != "宸插畬鎴�").Any())
+ if (!item.Where(x => x.OutStatus != "宸插畬鎴�").Any())
{
- if (Orders.FirstOrDefault().Out_type == OutOrderTypeEnum.Allocate.ObjToInt().ToString())
+ if (item.First().Out_type == OutOrderTypeEnum.Allocate.ObjToInt().ToString())
{
- foreach (var item in Orders)
+ foreach (var a in item)
{
- if (item.Details != null)
- _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
- item.Details = null;
+ if (a.Details != null) cabinOrderDetails.AddRange(a.Details);
+ a.Details = null;
+ cabinOrders.Add(a);
}
- _deliveryOrderServices.Repository.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
}
else
{
- var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
- var requestDate = new
- {
- order_no = outorder
- };
- var result = HttpHelper.Post(url, requestDate.ToJsonString());
+ var result = HttpHelper.Post(url, new { order_no = item.Key }.ToJsonString());
var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
if (response != null && response.resultCode == "0")
{
- foreach (var item in Orders)
+ foreach (var a in item)
{
- if (item.Details != null)
- _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.鑷姩瀹屾垚);
- item.Details = null;
+ if (a.Details != null) cabinOrderDetails.AddRange(a.Details);
+ a.Details = null;
+ cabinOrders.Add(a);
}
- _deliveryOrderServices.Repository.DeleteAndMoveIntoHty(Orders, OperateTypeEnum.鑷姩瀹屾垚);
}
else
{
string mess = "涓婃姤ERP鏃犲搷搴�";
if (response != null) mess = response.resultMsg;
- _messageInfoService.AddMessageInfo(MessageGroupByEnum.OutOrderAlarm, $"鍑哄簱鍗曞彿銆恵outorder}銆戝畬鎴愪笂鎶RP澶辫触", mess);
- //_unitOfWorkManage.RollbackTran();
- //SendErrorToUpstream(4, "", $"涓婃父鎺ュ彛杩斿洖澶辫触: {response.resultMsg}", outorder);
+ _messageInfoService.AddMessageInfo(MessageGroupByEnum.InOrderAlarm, $"鍑哄簱鍗曞彿銆恵item.Key}銆戝畬鎴愪笂鎶RP澶辫触", mess);
continue;
}
}
}
}
+ _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.鑷姩瀹屾垚);
+ _deliveryOrderServices.Repository.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.鑷姩瀹屾垚);
+
#endregion
- _unitOfWorkManage.CommitTran();
return responseContent.OK();
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
return responseContent.Error("鎵归噺澶勭悊澶辫触锛�" + ex.Message);
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
index 853c420..0bc06b6 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/CabinOrderServices.cs"
@@ -33,7 +33,7 @@
namespace WIDESEA_SquareCabinServices
{
- public class CabinOrderServices : ServiceBase<Dt_CabinOrder, IRepository<Dt_CabinOrder>>, ICabinOrderServices
+ public partial class CabinOrderServices : ServiceBase<Dt_CabinOrder, IRepository<Dt_CabinOrder>>, ICabinOrderServices
{
private readonly IMedicineGoodsServices _medicineGoodsServices;
private readonly IUnitOfWorkManage _unitOfWorkManage;
@@ -343,11 +343,13 @@
}).ToList()
};
dt_CabinOrders.Add(entityOrder);
- webResponseContent.OK(data: dt_CabinOrders);
+ BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
+ //webResponseContent.OK(data: dt_CabinOrders);
}
#endregion
else
{
+ #region 鍒涘缓鍏ュ簱鍗曞ご琛ㄣ�佸ぇ浠跺簱鍜岀珛搴�
var entityOrder = new Dt_CabinOrder//澶т欢搴撹鍗�
{
Order_no = order.order_no,
@@ -370,12 +372,16 @@
Warehouse_no = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"),
Details = new List<Dt_CabinOrderDetail>()
};
+ #endregion
+
+ List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => order.details.Select(x => x.goods_no).Contains(x.MaterielCode));
+ List<Dt_MaterielInfo> materielInfosUp = new List<Dt_MaterielInfo>();
foreach (var item in order.details)
{
// 灏嗕笂娓稿叆搴撴暟閲忚浆涓烘鏁�
item.order_qty = Math.Abs(item.order_qty);
#region 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡淇℃伅
- Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == item.goods_no);
+ Dt_MaterielInfo? materielInfo = materielInfos.Where(x => x.MaterielCode == item.goods_no).FirstOrDefault();
if (materielInfo == null) throw new Exception($"鏈壘鍒拌嵂鍝佺紪鐮併�恵item.goods_no}銆戠殑淇℃伅");
if (!Enum.IsDefined(typeof(MaterielSourceTypeEnum), materielInfo.MaterielSourceType))
throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵item.goods_no}銆戠殑灞炴�у垎绫�");
@@ -464,16 +470,22 @@
entityOrder.Details.Add(orderDetail);
}
#endregion
+ materielInfosUp.Add(materielInfo);
}
- _materielInfoService.UpdateData(materielInfo);
+ //_materielInfoService.UpdateData(materielInfo);
}
+ _unitOfWorkManage.BeginTran();
+ if (materielInfosUp.Count > 0) _materielInfoService.UpdateData(materielInfosUp);
if (entityOrder.Details.Count > 0) dt_CabinOrders.Add(entityOrder);
if (entityOrderLK.Details.Count > 0) dt_CabinOrders.Add(entityOrderLK);
- webResponseContent.OK(data: dt_CabinOrders);
+ if (dt_CabinOrders.Count > 0) BaseDal.Db.InsertNav(dt_CabinOrders).Include(x => x.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
+ //webResponseContent.OK(data: dt_CabinOrders);
}
}
catch (Exception ex)
{
+ _unitOfWorkManage.RollbackTran();
webResponseContent.Error(ex.Message);
}
return webResponseContent;
@@ -486,21 +498,27 @@
WebResponseContent content = new WebResponseContent();
try
{
- _unitOfWorkManage.BeginTran();
string WareCodeMJ = WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000");
string WareCodeLD = WarehouseEnum.鍐峰喕搴�.ObjToInt().ToString("000");
+ List<Dt_SupplyTask_Hty> supplyTask_Hties = new List<Dt_SupplyTask_Hty>();
+ List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>();
+ List<Dt_InventoryInfo> infosUp = new List<Dt_InventoryInfo>();
+ var codes = order.details.Select(x => x.goods_no).ToList();
#region 鐗规畩搴撴埧
if (order.warehouse_no == WareCodeMJ || order.warehouse_no == WareCodeLD)
{
+
+ List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => codes.Contains(x.MaterielCode));
+ List<Dt_InventoryInfo> _InventoryInfos = _inventoryInfoService.Repository.QueryData(x => codes.Contains(x.MaterielCode));
#region 搴撳瓨銆佸簱瀛樻壒娆″钩璐�
foreach (var item in order.details)
{
//鎵惧簱瀛樻壒娆′俊鎭�
- Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num);
+ Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
if (Qty != item.order_qty) throw new Exception($"鐩樼泩鍏ュ簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樼泩鏁伴噺鏈夎");
//鎵炬墍鏈夊簱瀛�
- List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo);
+ List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
foreach (var inventoryInfo in inventoryInfos)
{
#region 娣诲姞鐩樼泩鍏ュ簱浠诲姟
@@ -525,17 +543,20 @@
SupplyQuantity = 0,
Remark = "鐩樼泩鍏ュ簱"
};
- _supplyTaskHtyService.AddData(supplyTask_Hty);
+ //_supplyTaskHtyService.AddData(supplyTask_Hty);
+ supplyTask_Hties.Add(supplyTask_Hty);
}
#endregion
inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
+ infosUp.AddRange(inventoryInfos);
inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
inventory_Batch.SupplyQuantity = 0;
- _inventoryInfoService.UpdateData(inventoryInfos);
- _inventory_BatchServices.UpdateData(inventory_Batch);
+ batchesUp.Add(inventory_Batch);
+ //_inventoryInfoService.UpdateData(inventoryInfos);
+ //_inventory_BatchServices.UpdateData(inventory_Batch);
}
#endregion
@@ -561,24 +582,31 @@
Status = 2,
}).ToList()
};
- Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ _inventoryInfoService.UpdateData(infosUp);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ BaseDal.Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
//Repository.AddData(entityOrder);
#endregion
}
#endregion
else
{
+ List<Dt_CabinOrder> cabinOrdersAdd = new List<Dt_CabinOrder>();
string WareCodeLK = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
string WareCodeDJ = WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000");
-
+ List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => codes.Contains(x.MaterielCode));
+ List<Dt_InventoryInfo> _InventoryInfos = _inventoryInfoService.Repository.QueryData(x => codes.Contains(x.MaterielCode));
foreach (var item in order.details)
{
//鎵惧簱瀛樻壒娆′俊鎭�
- Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num);
+ Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
if (Qty != item.order_qty) throw new Exception($"鐩樼泩鍏ュ簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樼泩鏁伴噺鏈夎");
//鎵炬墍鏈夊簱瀛�
- List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo);
+ List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
//鑾峰彇绔嬪簱鐩樼偣宸紓鏁�
var inventoryLK = inventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First();
var LkQty = Math.Abs(inventoryLK.StockQuantity - inventoryLK.SupplyQuantity);
@@ -613,17 +641,20 @@
SupplyQuantity = 0,
Remark = "鐩樼泩鍏ュ簱"
};
- _supplyTaskHtyService.AddData(supplyTask_Hty);
+ //_supplyTaskHtyService.AddData(supplyTask_Hty);
+ supplyTask_Hties.Add(supplyTask_Hty);
}
#endregion
inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
- _inventoryInfoService.UpdateData(inventoryInfos);
+ //_inventoryInfoService.UpdateData(inventoryInfos);
+ infosUp.AddRange(inventoryInfos);
inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
inventory_Batch.SupplyQuantity = 0;
- _inventory_BatchServices.UpdateData(inventory_Batch);
+ //_inventory_BatchServices.UpdateData(inventory_Batch);
+ batchesUp.Add(inventory_Batch);
#endregion
#region 鍒涘缓澶т欢搴撶洏鐐瑰崟
@@ -649,8 +680,8 @@
}).ToList()
};
//Repository.AddData(entityOrder);
- Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
-
+ //Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ cabinOrdersAdd.Add(entityOrder);
#endregion
}
else
@@ -681,14 +712,16 @@
SupplyQuantity = 0,
Remark = "鐩樼泩鍏ュ簱"
};
- _supplyTaskHtyService.AddData(supplyTask_Hty);
+ //_supplyTaskHtyService.AddData(supplyTask_Hty);
+ supplyTask_Hties.Add(supplyTask_Hty);
}
#endregion
inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
- _inventoryInfoService.UpdateData(inventoryInfos);
+ //_inventoryInfoService.UpdateData(inventoryInfos);
+ infosUp.AddRange(inventoryInfos);
#endregion
#region 鍒涘缓澶т欢搴撶洏鐐瑰崟
@@ -716,8 +749,8 @@
}).ToList()
};
//Repository.AddData(cabinOrder);
- Db.InsertNav(cabinOrder).Include(it => it.Details).ExecuteCommand();
-
+ //Db.InsertNav(cabinOrder).Include(it => it.Details).ExecuteCommand();
+ cabinOrdersAdd.Add(cabinOrder);
}
#endregion
@@ -743,12 +776,18 @@
}).ToList()
};
//Repository.AddData(entityOrder);
- Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ //Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ cabinOrdersAdd.Add(entityOrder);
#endregion
}
}
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ _inventoryInfoService.UpdateData(infosUp);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ BaseDal.Db.InsertNav(cabinOrdersAdd).Include(it => it.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
}
- _unitOfWorkManage.CommitTran();
}
catch (Exception ex)
{
@@ -773,20 +812,20 @@
{
Dt_CabinOrder cabinOrder = BaseDal.QueryFirst(x => x.Id == key);
List<Dt_CabinOrder> cabinOrders = Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == cabinOrder.Order_no).Includes(x => x.Details).ToList();//鎵惧嚭鎵�鏈夊嚭搴撳崟鍙风浉鍚岀殑鍑哄簱鍗�
- _unitOfWorkManage.BeginTran();
+ List<Dt_CabinOrderDetail> cabinOrderDetails = new List<Dt_CabinOrderDetail>();
foreach (var item in cabinOrders)
{
- if (item.Details != null)
- _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.浜哄伐瀹屾垚);
+ if (item.Details != null) cabinOrderDetails.AddRange(cabinOrderDetails);
item.Modifier = App.User.UserName;
item.ModifyDate = DateTime.Now;
item.Details = null;
}
- BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.浜哄伐瀹屾垚);
-
if (cabinOrder.Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString())
- _unitOfWorkManage.CommitTran();
+ {
+ _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.浜哄伐瀹屾垚);
+ BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.浜哄伐瀹屾垚);
+ }
else
{
var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
@@ -798,13 +837,14 @@
var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
if (response == null) throw new Exception("涓婃姤ERP鍏ュ簱鍗曞畬鎴愬け璐ワ紒");
if (response.resultCode != "0") throw new Exception(response.resultMsg);
- _unitOfWorkManage.CommitTran();
+
+ _cabinOrderDetailServices.Repository.DeleteAndMoveIntoHty(cabinOrderDetails, OperateTypeEnum.浜哄伐瀹屾垚);
+ BaseDal.DeleteAndMoveIntoHty(cabinOrders, OperateTypeEnum.浜哄伐瀹屾垚);
}
content.OK();
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
content.Error(ex.Message);
}
return content;
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index 9883488..2267064 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -71,7 +71,6 @@
WebResponseContent webResponseContent = new WebResponseContent();
try
{
- _unitOfWorkManage.BeginTran();
Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "鍑哄簱绛栫暐");
#region 鐗规畩搴撴埧鍑哄簱
string WareCodeMJ = WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000");
@@ -99,19 +98,22 @@
Status = 2, // pad骞冲簱锛屾棤闇�鍚屾
}).ToList()
};
- BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
#endregion
#region 澶勭悊搴撳瓨銆佸簱瀛樻壒娆°�佹坊鍔犲嚭搴撲换鍔�
List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+ List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>();
+ List<Dt_InventoryInfo> inventoryInfosUp = new List<Dt_InventoryInfo>();
+ var inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => entityOrder.Details.Select(e => e.Goods_no).Contains(x.MaterielCode));
+ var InventoryInfos = _inventoryInfoService.Repository.QueryData(x => entityOrder.Details.Select(e => e.Goods_no).Contains(x.MaterielCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == outorder.warehouse_no);
foreach (var item in entityOrder.Details)
{
- Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num);
+ Dt_Inventory_Batch? inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num).FirstOrDefault();
if (inventory_Batch == null) throw new Exception($"鏈壘鍒板嚭搴撳崟鍙枫�恵entityOrder.Out_no}銆戜腑鐗╂枡缂栧彿銆恵item.Goods_no}銆戠墿鏂欐壒娆°�恵item.Batch_num}銆戠殑搴撳瓨鎵规淇℃伅");
if (inventory_Batch.AvailableQuantity < item.Order_qty) throw new Exception($"鍑哄簱鍗曞彿銆恵entityOrder.Out_no}銆戜腑鐗╂枡缂栧彿銆恵item.Goods_no}銆戠墿鏂欐壒娆°�恵item.Batch_num}銆戠殑搴撳瓨鎵规淇℃伅鍙敤鏁伴噺涓嶈冻");
inventory_Batch.AvailableQuantity -= item.Order_qty;
inventory_Batch.OutboundQuantity += item.Order_qty;
- List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.AvailableQuantity > 0 && x.WarehouseCode == item.Reservoirarea);
- if (dt_InventoryInfos.Count < 1) throw new Exception($"鍑哄簱鍗曞彿銆恵entityOrder.Out_no}銆戜腑鐗╂枡缂栧彿銆恵item.Goods_no}銆戠墿鏂欐壒娆°�恵item.Batch_num}銆戠殑搴撳瓨褰撳墠鐘舵�佷笉鍙嚭搴�");
+ List<Dt_InventoryInfo> dt_InventoryInfos = InventoryInfos.Where(x => x.MaterielCode == item.Goods_no && x.BatchNo == item.Batch_num).ToList();
+ if (dt_InventoryInfos.Count < 1) throw new Exception($"鍑哄簱鍗曞彿銆恵entityOrder.Out_no}銆戜腑鐗╂枡缂栧彿銆恵item.Goods_no}銆戠墿鏂欐壒娆°�恵item.Batch_num}銆戠殑鍙敤搴撳瓨涓嶈冻");
#region 鎸夊嚭搴撶瓥鐣ユ煡鎵惧簱瀛�
if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList();
@@ -170,11 +172,16 @@
supplyTasks.Add(supplyTask);
Order_qty = 0;
}
+ inventoryInfosUp.Add(InventoryInfo);
}
- _inventory_BatchServices.Repository.UpdateData(inventory_Batch);
- _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
+ batchesUp.Add(inventory_Batch);
}
+ _unitOfWorkManage.BeginTran();
_supplyTaskService.AddData(supplyTasks);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ _inventoryInfoService.UpdateData(inventoryInfosUp);
+ BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
#endregion
}
#endregion
@@ -207,16 +214,22 @@
};
#endregion
#region 鏌ユ壘搴撳瓨
+ List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>();
+ List<Dt_InventoryInfo> inventoryInfosUp = new List<Dt_InventoryInfo>();
+ List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
+ List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => outorder.details.Select(e => e.goods_no).Contains(x.MaterielCode));
+ var inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => outorder.details.Select(e => e.goods_no).Contains(x.MaterielCode));
+ var InventoryInfos = _inventoryInfoService.Repository.QueryData(x => outorder.details.Select(e => e.goods_no).Contains(x.MaterielCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.AvailableQuantity > 0 && (x.WarehouseCode == WareCodeDJ || x.WarehouseCode == WareCodeLK));
foreach (var detail in outorder.details)
{
#region 鏌ヨ搴撳瓨鎵规鍜屽簱瀛�
- Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == detail.goods_no && x.BatchNo == detail.batch_num);
+ Dt_Inventory_Batch? inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == detail.goods_no && x.BatchNo == detail.batch_num).FirstOrDefault();
if (inventory_Batch == null) throw new Exception($"鏈壘鍒板嚭搴撳崟鍙枫�恵outorder.order_no}銆戜腑鐗╂枡缂栧彿銆恵detail.goods_no}銆戠墿鏂欐壒娆°�恵detail.batch_num}銆戠殑搴撳瓨鎵规淇℃伅");
if (inventory_Batch.AvailableQuantity < detail.order_qty) throw new Exception($"鍑哄簱鍗曞彿銆恵outorder.order_no}銆戜腑鐗╂枡缂栧彿銆恵detail.goods_no}銆戠墿鏂欐壒娆°�恵detail.batch_num}銆戠殑搴撳瓨鎵规淇℃伅鍙敤鏁伴噺涓嶈冻");
inventory_Batch.AvailableQuantity -= detail.order_qty;
inventory_Batch.OutboundQuantity += detail.order_qty;
- List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo && x.AvailableQuantity > 0 && (x.WarehouseCode == WareCodeDJ || x.WarehouseCode == WareCodeLK));
- if (dt_InventoryInfos.Count < 1) throw new Exception($"鍑哄簱鍗曞彿銆恵outorder.order_no}銆戜腑鐗╂枡缂栧彿銆恵detail.goods_no}銆戠墿鏂欐壒娆°�恵detail.batch_num}銆戠殑搴撳瓨褰撳墠鐘舵�佷笉鍙嚭搴�");
+ List<Dt_InventoryInfo> dt_InventoryInfos = InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
+ if (dt_InventoryInfos.Count < 1) throw new Exception($"鍑哄簱鍗曞彿銆恵outorder.order_no}銆戜腑鐗╂枡缂栧彿銆恵detail.goods_no}銆戠墿鏂欐壒娆°�恵detail.batch_num}銆戠殑鍙敤搴撳瓨涓嶈冻");
#endregion
#region 鎸夊嚭搴撶瓥鐣ユ煡鎵惧簱瀛�
if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
@@ -226,7 +239,7 @@
#endregion
var Order_qty = Math.Abs(detail.order_qty);//鍑哄簱鍗曟暟閲�
#region 鏍规嵁鐗╂枡缂栫爜鏌ヨ鐗╂枡淇℃伅
- Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == detail.goods_no);
+ Dt_MaterielInfo? materielInfo = materielInfos.Where(x => x.MaterielCode == detail.goods_no).FirstOrDefault();
if (materielInfo == null) throw new Exception($"鏈壘鍒拌嵂鍝佺紪鐮併�恵detail.goods_no}銆戠殑淇℃伅");
if (!Enum.IsDefined(typeof(MaterielSourceTypeEnum), materielInfo.MaterielSourceType))
throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵detail.goods_no}銆戠殑灞炴�у垎绫�");
@@ -249,7 +262,6 @@
entityOrder.Details.Add(orderDetail);
#endregion
- List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
#region 璁$畻搴撳瓨銆佹坊鍔犲嚭搴撲换鍔�
foreach (var InventoryInfo in dt_InventoryInfos)
{
@@ -304,15 +316,16 @@
}
}
#endregion
- _inventory_BatchServices.Repository.UpdateData(inventory_Batch);
- _inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
- _supplyTaskService.AddData(supplyTasks);
+ inventoryInfosUp.AddRange(dt_InventoryInfos);
+ batchesUp.Add(inventory_Batch);
+ //_inventory_BatchServices.Repository.UpdateData(inventory_Batch);
+ //_inventoryInfoService.Repository.UpdateData(dt_InventoryInfos);
+ //_supplyTaskService.AddData(supplyTasks);
}
#endregion
else
{
if (materielInfo.BoxQty < 1) throw new Exception($"璇疯缃嵂鍝佺紪鍙枫�恵detail.goods_no}銆戠殑绠辫鏁伴噺");
- List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
Dt_DeliveryOrderDetail orderDetail = null;
Dt_DeliveryOrderDetail orderDetailLK = null;
var ys = Order_qty % materielInfo.BoxQty; //涓嶈兘鏁撮櫎绠辫鐨勬暎浠舵暟
@@ -385,7 +398,8 @@
Remark = "鍑哄簱"
};
supplyTasks.Add(supplyTask);
- _inventoryInfoService.Repository.UpdateData(item);
+ inventoryInfosUp.Add(item);
+ //_inventoryInfoService.Repository.UpdateData(item);
}
#endregion
@@ -439,22 +453,28 @@
};
supplyTasks.Add(supplyTask);
#endregion
- _inventoryInfoService.Repository.UpdateData(inventoryInfo);
+ //_inventoryInfoService.Repository.UpdateData(inventoryInfo);
+ inventoryInfosUp.Add(inventoryInfo);
entityOrderLK.Details.Add(orderDetailLK);
}
#endregion
if (orderDetail != null) entityOrder.Details.Add(orderDetail);
- _inventory_BatchServices.Repository.UpdateData(inventory_Batch);
- _supplyTaskService.AddData(supplyTasks);
+ batchesUp.Add(inventory_Batch);
+ //_inventory_BatchServices.Repository.UpdateData(inventory_Batch);
+ //_supplyTaskService.AddData(supplyTasks);
}
}
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskService.AddData(supplyTasks);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ _inventoryInfoService.UpdateData(inventoryInfosUp);
if (entityOrder.Details.Count > 0)
BaseDal.Db.CopyNew().InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
if (entityOrderLK.Details.Count > 0)
BaseDal.Db.CopyNew().InsertNav(entityOrderLK).Include(x => x.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
#endregion
}
- _unitOfWorkManage.CommitTran();
webResponseContent.OK();
}
catch (Exception ex)
@@ -472,21 +492,26 @@
WebResponseContent content = new WebResponseContent();
try
{
- _unitOfWorkManage.BeginTran();
string WareCodeMJ = WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000");
string WareCodeLD = WarehouseEnum.鍐峰喕搴�.ObjToInt().ToString("000");
+ List<Dt_SupplyTask_Hty> supplyTask_Hties = new List<Dt_SupplyTask_Hty>();
+ List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>();
+ List<Dt_InventoryInfo> infosUp = new List<Dt_InventoryInfo>();
+ var codes = order.details.Select(x => x.goods_no).ToList();
#region 鐗规畩搴撴埧
if (order.warehouse_no == WareCodeMJ || order.warehouse_no == WareCodeLD)
{
+ List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => codes.Contains(x.MaterielCode));
+ List<Dt_InventoryInfo> _InventoryInfos = _inventoryInfoService.Repository.QueryData(x => codes.Contains(x.MaterielCode));
#region 搴撳瓨銆佸簱瀛樻壒娆″钩璐�
foreach (var item in order.details)
{
//鎵惧簱瀛樻壒娆′俊鎭�
- Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num);
+ Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
if (Qty != item.order_qty) throw new Exception($"鐩樹簭鍑哄簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樹簭鏁伴噺鏈夎");
//鎵炬墍鏈夊簱瀛�
- List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo);
+ List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
foreach (var inventoryInfo in inventoryInfos)
{
#region 娣诲姞鐩樹簭鍑哄簱浠诲姟
@@ -511,7 +536,8 @@
SupplyQuantity = 0,
Remark = "鐩樹簭鍏ュ簱"
};
- _supplyTaskHtyService.AddData(supplyTask_Hty);
+ //_supplyTaskHtyService.AddData(supplyTask_Hty);
+ supplyTask_Hties.Add(supplyTask_Hty);
}
#endregion
inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
@@ -520,8 +546,10 @@
}
inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
inventory_Batch.SupplyQuantity = 0;
- _inventoryInfoService.UpdateData(inventoryInfos);
- _inventory_BatchServices.UpdateData(inventory_Batch);
+ infosUp.AddRange(inventoryInfos);
+ batchesUp.Add(inventory_Batch);
+ //_inventoryInfoService.UpdateData(inventoryInfos);
+ //_inventory_BatchServices.UpdateData(inventory_Batch);
}
#endregion
@@ -547,23 +575,30 @@
Status = 2,
}).ToList()
};
- Repository.AddData(entityOrder);
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ _inventoryInfoService.UpdateData(infosUp);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ BaseDal.Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
#endregion
}
#endregion
else
{
+ List<Dt_DeliveryOrder> deliveryOrdersAdd = new List<Dt_DeliveryOrder>();
string WareCodeLK = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
string WareCodeDJ = WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000");
-
+ List<Dt_Inventory_Batch> inventory_Batchs = _inventory_BatchServices.Repository.QueryData(x => codes.Contains(x.MaterielCode));
+ List<Dt_InventoryInfo> _InventoryInfos = _inventoryInfoService.Repository.QueryData(x => codes.Contains(x.MaterielCode));
foreach (var item in order.details)
{
//鎵惧簱瀛樻壒娆′俊鎭�
- Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num);
+ Dt_Inventory_Batch inventory_Batch = inventory_Batchs.Where(x => x.MaterielCode == item.goods_no && x.BatchNo == item.batch_num).First();
var Qty = Math.Abs(inventory_Batch.StockQuantity - inventory_Batch.SupplyQuantity);
- if (Qty != item.order_qty) throw new Exception($"鐩樼泩鍏ュ簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樼泩鏁伴噺鏈夎");
+ if (Qty != item.order_qty) throw new Exception($"鐩樹簭鍑哄簱鍗曘�恵order.order_no}銆戠墿鏂欑紪鍙枫�恵item.goods_no}銆戠墿鏂欐壒娆°�恵item.batch_num}銆戠殑鐩樹簭鏁伴噺鏈夎");
//鎵炬墍鏈夊簱瀛�
- List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo);
+ List<Dt_InventoryInfo> inventoryInfos = _InventoryInfos.Where(x => x.MaterielCode == inventory_Batch.MaterielCode && x.BatchNo == inventory_Batch.BatchNo).ToList();
//鑾峰彇绔嬪簱鐩樼偣宸紓鏁�.銆傘�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��
var inventoryLK = inventoryInfos.Where(x => x.WarehouseCode == WareCodeLK).First();
var LkQty = Math.Abs(inventoryLK.StockQuantity - inventoryLK.SupplyQuantity);
@@ -598,17 +633,20 @@
SupplyQuantity = 0,
Remark = "鐩樹簭鍏ュ簱"
};
- _supplyTaskHtyService.AddData(supplyTask_Hty);
+ //_supplyTaskHtyService.AddData(supplyTask_Hty);
+ supplyTask_Hties.Add(supplyTask_Hty);
}
#endregion
inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
- _inventoryInfoService.UpdateData(inventoryInfos);
+ //_inventoryInfoService.UpdateData(inventoryInfos);
inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
inventory_Batch.SupplyQuantity = 0;
- _inventory_BatchServices.UpdateData(inventory_Batch);
+ //_inventory_BatchServices.UpdateData(inventory_Batch);
+ infosUp.AddRange(inventoryInfos);
+ batchesUp.Add(inventory_Batch);
#endregion
#region 鍒涘缓澶т欢搴撶洏鐐瑰崟
@@ -633,8 +671,9 @@
Status = 2,
}).ToList()
};
- Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ //Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
//Repository.AddData(entityOrder);
+ deliveryOrdersAdd.Add(entityOrder);
#endregion
}
else
@@ -665,14 +704,16 @@
SupplyQuantity = 0,
Remark = "鐩樹簭鍑哄簱"
};
- _supplyTaskHtyService.AddData(supplyTask_Hty);
+ //_supplyTaskHtyService.AddData(supplyTask_Hty);
+ supplyTask_Hties.Add(supplyTask_Hty);
}
#endregion
inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
}
- _inventoryInfoService.UpdateData(inventoryInfos);
+ //_inventoryInfoService.UpdateData(inventoryInfos);
+ infosUp.AddRange(inventoryInfos);
#endregion
#region 鍒涘缓澶т欢搴撶洏鐐瑰崟
@@ -700,7 +741,8 @@
}).ToList()
};
//Repository.AddData(cabinOrder);
- Db.InsertNav(cabinOrder).Include(it => it.Details).ExecuteCommand();
+ //Db.InsertNav(cabinOrder).Include(it => it.Details).ExecuteCommand();
+ deliveryOrdersAdd.Add(cabinOrder);
}
#endregion
@@ -725,14 +767,20 @@
Status = 0,
}).ToList()
};
- Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
+ //Db.InsertNav(entityOrder).Include(it => it.Details).ExecuteCommand();
//Repository.AddData(entityOrder);
+ deliveryOrdersAdd.Add(entityOrder);
#endregion
}
//return WebResponseContent.Instance.OK("鎴愬姛");
}
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ _inventoryInfoService.UpdateData(infosUp);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ BaseDal.Db.InsertNav(deliveryOrdersAdd).Include(it => it.Details).ExecuteCommand();
+ _unitOfWorkManage.CommitTran();
}
- _unitOfWorkManage.CommitTran();
return WebResponseContent.Instance.OK("鎴愬姛");
}
catch (Exception ex)
@@ -880,7 +928,9 @@
Dt_SupplyTask supplyTask = _supplyTaskService.Repository.QueryFirst(x => x.TaskId == TaskId && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt());
if (supplyTask == null) throw new Exception("褰撳墠鍑哄簱浠诲姟宸插畬鎴�");
if (supplyTask.LocationCode != LocationCode) throw new Exception($"褰撳墠鍑哄簱璐т綅銆恵LocationCode}銆戜笌浠诲姟鍒嗛厤璐т綅涓嶅尮閰�");
- content = OutTaskFinish(supplyTask);
+ Dt_DeliveryOrder deliveryOrder = BaseDal.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode).Includes(x => x.Details).First();
+ if (deliveryOrder == null) return WebResponseContent.Instance.OK($"鍑哄簱鍗曞凡瀹屾垚");
+ content = OutTaskFinish(supplyTask, deliveryOrder);
}
catch (Exception ex)
{
@@ -888,17 +938,93 @@
}
return content;
}
+ public WebResponseContent OutTaskFinish(Dt_SupplyTask supplyTask, Dt_DeliveryOrder deliveryOrder)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ Dt_DeliveryOrderDetail? cabinOrderDetail = deliveryOrder.Details.FirstOrDefault(x => x.Batch_num == supplyTask.BatchNo && x.Goods_no == supplyTask.MaterielCode);
+ if (cabinOrderDetail == null) throw new Exception($"鍑哄簱鍗曟槑缁嗘湭鎵惧埌");
+ Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == supplyTask.MaterielCode);
+ if (materielInfo == null) throw new Exception($"璇风淮鎶ょ墿鏂欑紪鍙枫�恵supplyTask.MaterielCode}銆戠殑鐗╂枡淇℃伅");
+ cabinOrderDetail.Order_Outqty += supplyTask.StockQuantity;
+ if (cabinOrderDetail.Order_Outqty > cabinOrderDetail.Order_qty) throw new Exception($"鍑哄簱鏁伴噺涓嶅彲瓒呭嚭鍗曟嵁鏁伴噺");
+ deliveryOrder.OutStatus = "寮�濮�";
+ cabinOrderDetail.OotDetailStatus = "寮�濮�";
+ if (cabinOrderDetail.Order_Outqty == cabinOrderDetail.Order_qty) cabinOrderDetail.OotDetailStatus = "宸插畬鎴�";
+ #region 搴撳瓨
+ Dt_InventoryInfo inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.LocationCode == supplyTask.LocationCode);
+ if (inventoryInfo == null) throw new Exception($"鏈壘鍒拌揣浣嶃�恵supplyTask.LocationCode}銆戠殑搴撳瓨淇℃伅");
+ inventoryInfo.StockQuantity -= supplyTask.StockQuantity;
+ inventoryInfo.OutboundQuantity -= supplyTask.StockQuantity;
+ #endregion
+ Dt_LocationInfo location = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == supplyTask.LocationCode);
+ #region 璐т綅
+ if (supplyTask.WarehouseCode != WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
+ {
+ if (location == null)
+ return WebResponseContent.Instance.Error($"璇风淮鎶よ揣浣嶇紪鍙枫�恵supplyTask.LocationCode}銆戠殑璐т綅淇℃伅");
+ Dt_InventoryInfo inventoryInfo1 = _inventoryInfoService.Repository.QueryFirst(x => x.LocationCode == supplyTask.LocationCode);
+ if (inventoryInfo1 == null) location.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+ }
+ #endregion
+
+ #region 搴撳瓨鎵规 濡傛灉浠诲姟绫诲瀷鏄皟鎷ㄥ嚭搴撲换鍔★紙8锛夊氨涓嶄慨鏀规壒娆″簱瀛�
+ Dt_Inventory_Batch inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == inventoryInfo.BatchNo && x.MaterielCode ==
+ inventoryInfo.MaterielCode);
+ if (supplyTask.TaskType != TaskTypeEnum.AllocatOut.ObjToInt())
+ {
+ inventory_Batch.StockQuantity -= supplyTask.StockQuantity;
+ inventory_Batch.OutboundQuantity -= supplyTask.StockQuantity;
+ }
+ #endregion
+ if (supplyTask.WarehouseCode == WarehouseEnum.绔嬪簱.ObjToInt().ToString("000"))
+ {
+ materielInfo.Business_qty -= supplyTask.StockQuantity;
+ if (materielInfo.Business_qty < materielInfo.MinQty)
+ CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
+ }
+ supplyTask.TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt();
+
+ _unitOfWorkManage.BeginTran();
+ if (inventory_Batch.StockQuantity <= 0)
+ _inventory_BatchServices.DeleteData(inventory_Batch);
+ else
+ _inventory_BatchServices.UpdateData(inventory_Batch);
+ _materielInfoService.UpdateData(materielInfo);
+ if (inventoryInfo.StockQuantity <= 0)
+ _inventoryInfoService.DeleteData(inventoryInfo);
+ else
+ _inventoryInfoService.UpdateData(inventoryInfo);
+ if (location != null) _locationInfoService.UpdateData(location);
+ _deliveryOrderDetailServices.UpdateData(cabinOrderDetail);
+ _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.浜哄伐瀹屾垚);
+ _unitOfWorkManage.CommitTran();
+
+ #region 鍒ゆ柇璇︽儏鏄惁鍏ㄩ儴瀹屾垚
+ if (!_deliveryOrderDetailServices.Repository.QueryData(x => x.DeliveryOrderId == deliveryOrder.Id && x.OotDetailStatus != "宸插畬鎴�").Any())
+ deliveryOrder.OutStatus = "宸插畬鎴�";
+ BaseDal.UpdateData(deliveryOrder);
+ #endregion
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
public WebResponseContent OutTaskFinish(Dt_SupplyTask supplyTask)
{
WebResponseContent content = new WebResponseContent();
try
{
Dt_DeliveryOrder? cabinOrder = BaseDal.Db.CopyNew().Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == supplyTask.OrderNo && x.Warehouse_no == supplyTask.WarehouseCode).Includes(x => x.Details).First();
- if (cabinOrder == null) return WebResponseContent.Instance.Error($"鍑哄簱鍗曞凡瀹屾垚");
+ if (cabinOrder == null) return WebResponseContent.Instance.OK($"鍑哄簱鍗曞凡瀹屾垚");
Dt_DeliveryOrderDetail? cabinOrderDetail = cabinOrder.Details.Where(x => x.Batch_num == supplyTask.BatchNo && x.Reservoirarea == supplyTask.WarehouseCode && x.Goods_no == supplyTask.MaterielCode).FirstOrDefault();
- if (cabinOrderDetail == null) return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁嗗凡瀹屾垚");
+ if (cabinOrderDetail == null) return WebResponseContent.Instance.Error($"鍑哄簱鍗曟槑缁嗘湭鎵惧埌");
Dt_MaterielInfo materielInfo = _materielInfoService.Repository.QueryFirst(x => x.MaterielCode == cabinOrderDetail.Goods_no);
if (materielInfo == null) return WebResponseContent.Instance.Error($"璇风淮鎶ょ墿鏂欑紪鍙枫�恵cabinOrderDetail.Goods_no}銆戠殑鐗╂枡淇℃伅");
cabinOrderDetail.Order_Outqty += supplyTask.StockQuantity;
@@ -907,7 +1033,7 @@
#region 澶勭悊鍑哄簱鍗曪紝璐т綅锛屽簱瀛橈紝搴撳瓨鎵规淇℃伅,鍑哄簱浠诲姟
- _unitOfWorkManage.BeginTran();
+ //_unitOfWorkManage.BeginTran();
#region 鍑哄簱鍗�
cabinOrder.OutStatus = "寮�濮�";
@@ -979,7 +1105,7 @@
if (materielInfo.Business_qty < materielInfo.MinQty)
CreateAllocatInOut(materielInfo);//鍒涘缓璋冩嫧浠诲姟
}
- _unitOfWorkManage.CommitTran();
+ //_unitOfWorkManage.CommitTran();
#endregion
content.OK();
}
@@ -1002,23 +1128,22 @@
{
Dt_DeliveryOrder deliveryOrder = BaseDal.QueryFirst(x => x.Id == key);
List<Dt_DeliveryOrder> deliveryOrders = Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == deliveryOrder.Out_no).Includes(x => x.Details).ToList();//鎵惧嚭鎵�鏈夊嚭搴撳崟鍙风浉鍚岀殑鍑哄簱鍗�
- _unitOfWorkManage.BeginTran();
-
+ List<Dt_DeliveryOrderDetail> deliveryOrderDetails = new List<Dt_DeliveryOrderDetail>();
foreach (var item in deliveryOrders)
{
- if (item.Details != null)
- _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(item.Details, OperateTypeEnum.浜哄伐瀹屾垚);
+ if (item.Details != null) deliveryOrderDetails.AddRange(item.Details);
item.Modifier = App.User.UserName;
item.ModifyDate = DateTime.Now;
item.Details = null;
}
- BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.浜哄伐瀹屾垚);
if (deliveryOrder.Out_type == OutOrderTypeEnum.Allocate.ObjToInt().ToString())
- _unitOfWorkManage.CommitTran();
+ {
+ _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(deliveryOrderDetails, OperateTypeEnum.浜哄伐瀹屾垚);
+ BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.浜哄伐瀹屾垚);
+ }
else
{
var url = "http://121.37.118.63:80/GYZ2/95fck/outOrderOk";
-
var requestDate = new
{
order_no = deliveryOrder.Out_no
@@ -1027,13 +1152,13 @@
var response = JsonConvert.DeserializeObject<UpstreamOrderResponse>(result);
if (response == null) throw new Exception("涓婃姤ERP鍑哄簱鍗曞畬鎴愬け璐ワ紒");
if (response.resultCode != "0") throw new Exception(response.resultMsg);
- _unitOfWorkManage.CommitTran();
+ _deliveryOrderDetailServices.Repository.DeleteAndMoveIntoHty(deliveryOrderDetails, OperateTypeEnum.浜哄伐瀹屾垚);
+ BaseDal.DeleteAndMoveIntoHty(deliveryOrders, OperateTypeEnum.浜哄伐瀹屾垚);
}
content.OK();
}
catch (Exception ex)
{
- _unitOfWorkManage.RollbackTran();
content.Error(ex.Message);
}
return content;
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
index 37bc1f4..d0f0bb3 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/InventoryServices.cs"
@@ -28,12 +28,15 @@
{
public class InventoryServices : ServiceBase<Dt_Inventory, IRepository<Dt_Inventory>>, IInventoryServices
{
+ private readonly ICabinOrderServices _cabinOrderServices;
private readonly IDeliveryOrderServices _deliveryOrderServices;
- public InventoryServices(IRepository<Dt_Inventory> BaseDal, IDeliveryOrderServices deliveryOrderServices) : base(BaseDal)
+ private readonly ISupplyTaskService _supplyTaskService;
+ public InventoryServices(IRepository<Dt_Inventory> BaseDal, ICabinOrderServices cabinOrderServices, IDeliveryOrderServices deliveryOrderServices, ISupplyTaskService supplyTaskService) : base(BaseDal)
{
+ _cabinOrderServices = cabinOrderServices;
_deliveryOrderServices = deliveryOrderServices;
+ _supplyTaskService = supplyTaskService;
}
-
/// <summary>
/// 鑾峰彇涓婃父搴撳瓨淇℃伅
@@ -88,13 +91,85 @@
}
+ public ApiResponse<Dt_InventoryInfo> OrderFeedback(EdiOrderCallbackRequest request)
+ {
+ try
+ {
+ if (request == null || request.details == null || request.details.Count < 1) throw new Exception("璇锋眰鍙傛暟鏃犳晥");
+ var Warecode = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
+ switch (request.orderType)
+ {
+ case "1": //鍏ュ簱
+ {
+ Dt_CabinOrder cabinOrder = _cabinOrderServices.Db.Queryable<Dt_CabinOrder>().Where(x => x.Order_no == request.externalOrderNo && x.Warehouse_no == Warecode).Includes(x => x.Details).First();
+ if (cabinOrder == null) throw new Exception($"鏈壘鍒板叆搴撳崟鍙枫�恵request.externalOrderNo}銆戠殑鍏ュ簱鍗曚俊鎭�");
+ if (cabinOrder.OdrderStatus == "宸插畬鎴�")
+ return new ApiResponse<Dt_InventoryInfo> { code = "0", msg = $"鎴愬姛" };
+ WebResponseContent content = _cabinOrderServices.CompleteLKInOrder(cabinOrder, request);
+ if (!content.Status) throw new Exception(content.Message);
+ }
+ break;
+ case "2":
+ {
+ Dt_DeliveryOrder deliveryOrder = _deliveryOrderServices.Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == request.externalOrderNo && x.Warehouse_no == Warecode).Includes(x => x.Details).First();
+ if (deliveryOrder == null) throw new Exception($"鏈壘鍒板嚭搴撳崟鍙枫�恵request.externalOrderNo}銆戠殑鍑哄簱鍗曚俊鎭�");
+ if (deliveryOrder.OutStatus == "宸插畬鎴�")
+ return new ApiResponse<Dt_InventoryInfo> { code = "0", msg = $"鎴愬姛" };
+ WebResponseContent content = _deliveryOrderServices.CompleteLKOutOrder(deliveryOrder, request);
+ if (!content.Status) throw new Exception(content.Message);
+ }
+ break;
+ case "3":
+ {
+ #region 鎵剧洏鐐逛换鍔�
+ List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => x.OrderNo == request.externalOrderNo && x.WarehouseCode == Warecode && x.TaskStatus == SupplyStatusEnum.NewCheck.ObjToInt());
+ foreach (var detail in request.details)
+ {
+ Dt_SupplyTask? supplyTask = supplyTasks.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).FirstOrDefault();
+ if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.externalOrderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鐩樼偣浠诲姟");
+ if (detail.isLossOrProfit == 1) // 鐩樹簭
+ {
+ supplyTask.SupplyQuantity = supplyTask.StockQuantity - detail.ea;
+ }
+ else if (detail.isLossOrProfit == 2) // 鐩樼泩
+ {
+ supplyTask.SupplyQuantity = supplyTask.StockQuantity + detail.ea;
+ }
+ else // 鐩樹腑
+ {
+ supplyTask.SupplyQuantity = supplyTask.StockQuantity;
+ }
+ var content = _deliveryOrderServices.CheckTaskFinish(supplyTask);
+ if (!content.Status) throw new Exception(content.Message);
+ }
+ #endregion
+ }
+ break;
+ default:
+ throw new Exception($"鏈畾涔夌殑绫诲瀷銆恵request.orderType}銆�");
+ }
+ return new ApiResponse<Dt_InventoryInfo>
+ {
+ code = "0",
+ msg = $"鎴愬姛"
+ };
+ }
+ catch (Exception ex)
+ {
+ return new ApiResponse<Dt_InventoryInfo>
+ {
+ code = "500",
+ msg = $"澶勭悊澶辫触: {ex.Message}"
+ };
+ }
+ }
/// <summary>
/// wcs鍥炰紶缁欐垜璋冪敤鎴戠殑鏂规硶 涓嶇鏄叆搴� 鍑哄簱 鐩樼偣閮戒細璋冪敤杩欎釜鎺ュ彛
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
- public ApiResponse<Dt_InventoryInfo> OrderFeedback(EdiOrderCallbackRequest request)
+ public ApiResponse<Dt_InventoryInfo> OrderFeedback1(EdiOrderCallbackRequest request)
{
try
{
@@ -105,7 +180,7 @@
}
var reslut = WarehouseEnum.绔嬪簱.ObjToInt().ToString("000");
// 2锔忊儯 寮�鍚簨鍔�
- BaseDal.Db.Ado.BeginTran();
+ //BaseDal.Db.Ado.BeginTran();
foreach (var detail in request.details)
{
#region 鏌ヨ鐗╂枡淇℃伅銆佽绠楁�诲拰
@@ -306,7 +381,7 @@
case "2":
{
Dt_DeliveryOrder cabinOrder = Db.Queryable<Dt_DeliveryOrder>().Where(x => x.Out_no == request.externalOrderNo && x.Warehouse_no == reslut).Includes(x => x.Details).First();
- if (cabinOrder == null) throw new Exception($"鏈壘鍒板嚭搴撳崟鍙枫�恵request.externalOrderNo}銆戠殑鍏ュ簱鍗曚俊鎭�");
+ if (cabinOrder == null) throw new Exception($"鏈壘鍒板嚭搴撳崟鍙枫�恵request.externalOrderNo}銆戠殑鍑哄簱鍗曚俊鎭�");
if (cabinOrder.Out_type == "6")
{
@@ -398,7 +473,7 @@
}
// 9锔忊儯 鎻愪氦浜嬪姟
- BaseDal.Db.Ado.CommitTran();
+ //BaseDal.Db.Ado.CommitTran();
return new ApiResponse<Dt_InventoryInfo>
{
@@ -409,13 +484,15 @@
catch (Exception ex)
{
// 馃敓 鍥炴粴浜嬪姟
- BaseDal.Db.Ado.RollbackTran();
+ //BaseDal.Db.Ado.RollbackTran();
return new ApiResponse<Dt_InventoryInfo>
{
code = "500",
msg = $"澶勭悊澶辫触: {ex.Message}"
};
+
+ //Console.WriteLine(ex.Message);
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
new file mode 100644
index 0000000..1392201
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
@@ -0,0 +1,231 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Common.OrderEnum;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Core;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
+using WIDESEA_Model.Models;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
+using static WIDESEA_DTO.SquareCabin.TowcsDto;
+
+namespace WIDESEA_SquareCabinServices
+{
+ public partial class CabinOrderServices
+ {
+ /// <summary>
+ /// 绔嬪簱鍏ュ簱浠诲姟瀹屾垚
+ /// </summary>
+ /// <param name="request"></param>
+ /// <returns></returns>
+ public WebResponseContent CompleteLKInOrder(Dt_CabinOrder cabinOrder, EdiOrderCallbackRequest request)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ List<Dt_CabinOrderDetail> cabinOrderDetailsUp = new List<Dt_CabinOrderDetail>();
+ List<Dt_SupplyTask_Hty> supplyTask_Hties = new List<Dt_SupplyTask_Hty>();
+ List<Dt_InventoryInfo> infosUp = new List<Dt_InventoryInfo>();
+ List<Dt_InventoryInfo> infosAdd = new List<Dt_InventoryInfo>();
+ List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>();
+ List<Dt_Inventory_Batch> batchesAdd = new List<Dt_Inventory_Batch>();
+ List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+ List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Warehouse_no == x.WarehouseCode && cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+ List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+ #region 鐩樼泩鍏ュ簱鍗�
+ if (cabinOrder.Order_type == "5")
+ {
+ foreach (var detail in request.details)
+ {
+ Dt_CabinOrderDetail? orderDetail = cabinOrder.Details.FirstOrDefault(x => x.Goods_no == detail.productCode && x.Batch_num == detail.batchNo);
+ if (orderDetail == null) throw new Exception($"鏈壘鍒扮洏鐐瑰崟銆恵cabinOrder.Order_no}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠墿鏂欐壒娆°�恵detail.batchNo}銆戠殑鏄庣粏淇℃伅");
+ decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
+ Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
+ var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity;
+ if (orderQty != qty)
+ throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵qty}銆�");
+ inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+ inventoryInfo.SupplyQuantity = 0;
+ inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ infosUp.Add(inventoryInfo);
+ Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
+ inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+ inventory_Batch.SupplyQuantity = 0;
+ batchesUp.Add(inventory_Batch);
+ orderDetail.OrderDetailStatus = "宸插畬鎴�";
+ cabinOrderDetailsUp.Add(orderDetail);
+ #region 娣诲姞鐩樼泩鍏ュ簱浠诲姟
+ Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
+ {
+ WarehouseCode = inventoryInfo.WarehouseCode,
+ OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
+ InsertTime = DateTime.Now,
+ TaskStatus = SupplyStatusEnum.InFinish.ObjToInt(),
+ BatchNo = inventoryInfo.BatchNo,
+ MaterielName = inventoryInfo.MaterielName,
+ MaterielCode = inventoryInfo.MaterielCode,
+ MaterielSpec = inventoryInfo.MaterielSpec,
+ TaskType = TaskTypeEnum.ChenckIn.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = inventoryInfo.LocationCode,
+ OrderNo = cabinOrder.Order_no,
+ StockQuantity = orderQty,
+ SupplyQuantity = 0,
+ Remark = "鐩樼泩鍏ュ簱"
+ };
+ supplyTask_Hties.Add(supplyTask_Hty);
+ #endregion
+ }
+ cabinOrder.OdrderStatus = "宸插畬鎴�";
+ if (cabinOrder.Details.Where(x => !cabinOrderDetailsUp.Select(x => x.Id).Contains(x.Id)).Any())
+ cabinOrder.OdrderStatus = "寮�濮�";
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ _inventoryInfoService.UpdateData(infosUp);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ _cabinOrderDetailServices.UpdateData(cabinOrderDetailsUp);
+ BaseDal.UpdateData(cabinOrder);
+ _unitOfWorkManage.CommitTran();
+ }
+ #endregion
+ else
+ {
+ foreach (var detail in request.details)
+ {
+ Dt_CabinOrderDetail? orderDetail = cabinOrder.Details.FirstOrDefault(x => x.Goods_no == detail.productCode && x.Batch_num == detail.batchNo);
+ if (orderDetail == null) throw new Exception($"鏈壘鍒扮洏鐐瑰崟銆恵cabinOrder.Order_no}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠墿鏂欏悕绉般�恵detail.batchNo}銆戠殑鏄庣粏淇℃伅");
+ if (orderDetail.OrderDetailStatus == "宸插畬鎴�") continue;
+ decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
+ orderDetail.Order_Inqty += orderQty;
+ if (orderDetail.Order_Inqty > orderDetail.Order_qty) throw new Exception($"鍏ュ簱鏁伴噺涓嶅彲瓒呭嚭鍗曟嵁鏁伴噺");
+ orderDetail.OrderDetailStatus = "寮�濮�";
+ cabinOrder.OdrderStatus = orderDetail.OrderDetailStatus;
+ if (orderDetail.Order_Inqty == orderDetail.Order_qty)
+ {
+ orderDetail.OrderDetailStatus = "宸插畬鎴�";
+ cabinOrder.Details.Remove(orderDetail);
+ }
+ cabinOrderDetailsUp.Add(orderDetail);
+ Dt_MaterielInfo? materielInfo = materielInfos.FirstOrDefault(x => orderDetail.Goods_no == x.MaterielCode);
+ if (materielInfo == null) throw new Exception($"鏈壘鍒扮墿鏂欑紪鐮併�恵orderDetail.Goods_no}銆戠殑鐗╂枡淇℃伅");
+ #region 搴撳瓨
+ Dt_InventoryInfo? dt_InventoryInfo = inventoryInfos.FirstOrDefault(x => x.MaterielCode == orderDetail.Goods_no && x.BatchNo == orderDetail.Batch_num);
+ if (dt_InventoryInfo != null)
+ {
+ dt_InventoryInfo.StockQuantity += orderQty;
+ dt_InventoryInfo.AvailableQuantity += orderQty;
+ dt_InventoryInfo.InDate = DateTime.Now;
+ infosUp.Add(dt_InventoryInfo);
+ }
+ else
+ {
+ dt_InventoryInfo = new Dt_InventoryInfo
+ {
+ PalletCode = detail.orderDetails?.FirstOrDefault()?.palletCode ?? "",
+ WarehouseCode = "001",
+ LocationCode = "绔嬪簱",
+ StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt(),
+ MaterielCode = materielInfo.MaterielCode,
+ MaterielName = materielInfo.MaterielName,
+ MaterielSpec = materielInfo.MaterielSpec,
+ BatchNo = detail.batchNo,
+ StockQuantity = orderQty,
+ OutboundQuantity = 0,
+ SupplyQuantity = 0,
+ AvailableQuantity = orderQty,
+ InDate = DateTime.Now,
+ ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
+ ShelfLife = 0,
+ ValidityPeriod = orderDetail.Exp_date,
+ Remark = "鏅鸿兘绔嬪簱"
+ };
+ infosAdd.Add(dt_InventoryInfo);
+ }
+ #endregion
+
+ #region 搴撳瓨鎵规
+ if (cabinOrder.Order_type != InOrderTypeEnum.Allocat.ObjToInt().ToString())
+ {
+ Dt_Inventory_Batch? inventory_Batch = inventory_Batches.FirstOrDefault(x => x.MaterielCode == dt_InventoryInfo.MaterielCode && x.BatchNo == dt_InventoryInfo.BatchNo);
+ if (inventory_Batch != null)
+ {
+ inventory_Batch.StockQuantity += orderQty;
+ inventory_Batch.AvailableQuantity += orderQty;
+ batchesUp.Add(inventory_Batch);
+ }
+ else
+ {
+ inventory_Batch = new Dt_Inventory_Batch
+ {
+ MaterielCode = dt_InventoryInfo.MaterielCode,
+ MaterielName = dt_InventoryInfo.MaterielName,
+ MaterielSpec = dt_InventoryInfo.MaterielSpec,
+ BatchNo = dt_InventoryInfo.BatchNo,
+ StockQuantity = dt_InventoryInfo.StockQuantity,
+ OutboundQuantity = dt_InventoryInfo.OutboundQuantity,
+ AvailableQuantity = dt_InventoryInfo.AvailableQuantity,
+ SupplyQuantity = dt_InventoryInfo.SupplyQuantity,
+ ERPStockQuantity = 0,
+ Status = false,
+ ProductionDate = detail.finishDate.ToString("yyyy-MM-dd"),
+ ValidityPeriod = dt_InventoryInfo.ValidityPeriod.ObjToDate(),
+ Remark = "鑷姩鍒涘缓"
+ };
+ batchesAdd.Add(inventory_Batch);
+ }
+ }
+ #endregion
+
+ #region 娣诲姞鍏ュ簱浠诲姟鍘嗗彶
+ Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
+ {
+ WarehouseCode = dt_InventoryInfo.WarehouseCode,
+ TaskNum = dt_InventoryInfo.Id,
+ OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
+ InsertTime = DateTime.Now,
+ TaskStatus = SupplyStatusEnum.InFinish.ObjToInt(),
+ BatchNo = dt_InventoryInfo.BatchNo,
+ MaterielName = dt_InventoryInfo.MaterielName,
+ MaterielCode = dt_InventoryInfo.MaterielCode,
+ MaterielSpec = dt_InventoryInfo.MaterielSpec,
+ TaskType = cabinOrder.Order_type == "1" ? TaskTypeEnum.In.ObjToInt() : TaskTypeEnum.OutReturn.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = dt_InventoryInfo.LocationCode,
+ OrderNo = cabinOrder.Order_no,
+ StockQuantity = orderQty,
+ SupplyQuantity = 0,
+ Remark = "鍏ュ簱"
+ };
+ if (cabinOrder.Order_type == InOrderTypeEnum.Allocat.ObjToInt().ToString()) supplyTask_Hty.TaskType = TaskTypeEnum.AllocatIn.ObjToInt();
+ supplyTask_Hties.Add(supplyTask_Hty);
+ #endregion
+ }
+ if (cabinOrder.Details == null || !cabinOrder.Details.Where(x => x.OrderDetailStatus != "宸插畬鎴�").Any())
+ cabinOrder.OdrderStatus = "宸插畬鎴�";
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ if (infosUp.Count > 0) _inventoryInfoService.UpdateData(infosUp);
+ if (infosAdd.Count > 0) _inventoryInfoService.AddData(infosAdd);
+ if (batchesUp.Count > 0) _inventory_BatchServices.UpdateData(batchesUp);
+ if (batchesAdd.Count > 0) _inventory_BatchServices.AddData(batchesAdd);
+ _cabinOrderDetailServices.UpdateData(cabinOrderDetailsUp);
+ BaseDal.UpdateData(cabinOrder);
+ _unitOfWorkManage.CommitTran();
+ }
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
new file mode 100644
index 0000000..a806578
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
@@ -0,0 +1,119 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using static WIDESEA_DTO.SquareCabin.TowcsDto;
+using WIDESEA_Core;
+using WIDESEA_Model.Models;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Core.Enums;
+using WIDESEA_ISquareCabinServices;
+using WIDESEA_Core.Helper;
+
+namespace WIDESEA_SquareCabinServices
+{
+ public partial class DeliveryOrderServices
+ {
+ public WebResponseContent CompleteLKOutOrder(Dt_DeliveryOrder deliveryOrder, EdiOrderCallbackRequest request)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ List<Dt_DeliveryOrderDetail> cabinOrderDetailsUp = new List<Dt_DeliveryOrderDetail>();
+ List<Dt_SupplyTask_Hty> supplyTask_Hties = new List<Dt_SupplyTask_Hty>();
+ List<Dt_InventoryInfo> infosUp = new List<Dt_InventoryInfo>();
+ List<Dt_Inventory_Batch> batchesUp = new List<Dt_Inventory_Batch>();
+ List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+ List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => deliveryOrder.Warehouse_no == x.WarehouseCode && deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+ List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+ #region 鐩樹簭鍑哄簱鍗�
+ if (deliveryOrder.Out_type == "6")
+ {
+ try
+ {
+ foreach (var detail in request.details)
+ {
+ Dt_DeliveryOrderDetail? orderDetail = deliveryOrder.Details.FirstOrDefault(x => x.Goods_no == detail.productCode && x.Batch_num == detail.batchNo);
+ if (orderDetail == null) throw new Exception($"鏈壘鍒扮洏鐐瑰崟銆恵deliveryOrder.Out_no}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠墿鏂欐壒娆°�恵detail.batchNo}銆戠殑鏄庣粏淇℃伅");
+ decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
+ Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
+ var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity;
+ if (orderQty != qty)
+ throw new Exception($"鐩樹簭鍑哄簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樹簭鏁伴噺銆恵qty}銆�");
+ inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+ inventoryInfo.SupplyQuantity = 0;
+ inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+ infosUp.Add(inventoryInfo);
+ Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
+ inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+ inventory_Batch.SupplyQuantity = 0;
+ batchesUp.Add(inventory_Batch);
+ orderDetail.OotDetailStatus = "宸插畬鎴�";
+ cabinOrderDetailsUp.Add(orderDetail);
+ #region 娣诲姞鐩樼泩鍏ュ簱浠诲姟
+ Dt_SupplyTask_Hty supplyTask_Hty = new Dt_SupplyTask_Hty()
+ {
+ WarehouseCode = inventoryInfo.WarehouseCode,
+ OperateType = OperateTypeEnum.鑷姩瀹屾垚.ToString(),
+ InsertTime = DateTime.Now,
+ TaskStatus = SupplyStatusEnum.OutFinish.ObjToInt(),
+ BatchNo = inventoryInfo.BatchNo,
+ MaterielName = inventoryInfo.MaterielName,
+ MaterielCode = inventoryInfo.MaterielCode,
+ MaterielSpec = inventoryInfo.MaterielSpec,
+ TaskType = TaskTypeEnum.ChenckOut.ObjToInt(),
+ CreateDate = DateTime.Now,
+ Creater = App.User.UserName,
+ LocationCode = inventoryInfo.LocationCode,
+ OrderNo = deliveryOrder.Out_no,
+ StockQuantity = orderQty,
+ SupplyQuantity = 0,
+ Remark = "鐩樹簭鍑哄簱"
+ };
+ supplyTask_Hties.Add(supplyTask_Hty);
+ #endregion
+ }
+ deliveryOrder.OutStatus = "宸插畬鎴�";
+ if (deliveryOrder.Details.Where(x => !cabinOrderDetailsUp.Select(x => x.Id).Contains(x.Id)).Any())
+ deliveryOrder.OutStatus = "寮�濮�";
+ _unitOfWorkManage.BeginTran();
+ _supplyTaskHtyService.AddData(supplyTask_Hties);
+ _inventoryInfoService.UpdateData(infosUp);
+ _inventory_BatchServices.UpdateData(batchesUp);
+ _deliveryOrderDetailServices.UpdateData(cabinOrderDetailsUp);
+ BaseDal.UpdateData(deliveryOrder);
+ _unitOfWorkManage.CommitTran();
+ }
+ catch (Exception ex)
+ {
+ _unitOfWorkManage.RollbackTran();
+ throw new Exception(ex.Message);
+ }
+ }
+ #endregion
+ else
+ {
+ List<Dt_SupplyTask> supplyTasks = _supplyTaskService.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode) && x.OrderNo == request.externalOrderNo && x.WarehouseCode == deliveryOrder.Warehouse_no && x.TaskStatus == SupplyStatusEnum.NewOut.ObjToInt());
+ foreach (var detail in request.details)
+ {
+ decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
+ Dt_SupplyTask? supplyTask = supplyTasks.FirstOrDefault(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo);
+ if (supplyTask == null) throw new Exception($"鏈壘鍒拌鍗曞彿銆恵request.externalOrderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱浠诲姟");
+ if (supplyTask.StockQuantity != orderQty)
+ throw new Exception($"璁㈠崟鍙枫�恵request.orderNo}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠殑鍑哄簱鏁伴噺涓庡嚭搴撲换鍔℃暟閲忎笉鐩哥瓑");
+ content = OutTaskFinish(supplyTask, deliveryOrder);
+ if (!content.Status) throw new Exception(content.Message);
+ }
+ }
+ content.OK();
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs"
index b5fbd06..9675747 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/MedicineGoodsServices.cs"
@@ -27,179 +27,7 @@
}
public IRepository<Dt_MedicineGoods> Repository => BaseDal;
- static string SearchDate = "2025-10-30 00:00:00";
- /// <summary>
- /// 鑾峰彇鑽搧鍩虹淇℃伅鍚屾鎺ュ彛
- /// </summary>
- /// <returns></returns>
- public WebResponseContent GetMedicineGoodsInfom()
- {
- var responseContent = new WebResponseContent();
- try
- {
-
- var url = "http://121.37.118.63:80/GYZ2/95fck/goodsInfo";
-
-
- //if (string.IsNullOrEmpty(SearchDate)) SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- //璇锋眰鍙傛暟
- //var requestData = new
- //{
- // searchDate = "2009-01-10 20:45:16" // 姝g‘鐨勬牸寮�
- //};
- if (string.IsNullOrEmpty(SearchDate))
- {
- // 榛樿鏌ヨ杩囧幓24灏忔椂鐨勬暟鎹�
- SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- }
- // 璇锋眰鍙傛暟
- var requestData = new
- {
- searchDate = SearchDate
- };
- SearchDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- // 鍙戣捣璇锋眰
- var result = HttpHelper.Post(url, requestData.ToJsonString());
-
- // 鍙嶅簭鍒楀寲
- var response = JsonConvert.DeserializeObject<UpstreamResponse<MedicationsInfo>>(result);
-
- if (response == null || response.resultCode != "0")
- {
- // 璋冪敤寮傚父鎺ュ彛
- //SendErrorToUpstream(5, "", response.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触", "");
- return responseContent.Error(response?.resultMsg ?? "涓婃父鎺ュ彛杩斿洖澶辫触");
- }
- if (response.data.Count < 1)
- {
- return responseContent.OK("鏃犳柊鑽搧鏁版嵁");
- }
-
- //鑾峰彇鎵�鏈夊凡瀛樺湪鐨勫晢鍝佺紪鍙�
- var existingGoodsNos = BaseDal.Db.Queryable<Dt_MaterielInfo>()
- .Select(g => g.MaterielCode)
- .ToList();
-
- // 鏀堕泦鎵�鏈夎鎻掑叆鐨勫疄浣�
- var entityList = response.data.Where(Medicat => !existingGoodsNos.Contains(Medicat.goods_no)).Select(Medicat => new Dt_MaterielInfo
- {
- MaterielCode = Medicat.goods_no,
- MaterielErpType = Medicat.goods_type,
- item = Medicat.goods_tym, //閫氱敤鍚�
- MaterielName = Medicat.goods_spm,//鐗╂枡鍚嶇О
- Dosage_form = GetDosageForm(Medicat.dosage_form),//鑽墏
- Barcode = Medicat.barcode,//鏉″舰鍚�
- MaterielSpec = Medicat.model,
- Factory = Medicat.factory,
- MaterielUnit = Medicat.unit,//鍗曚綅
- MaterielSourceType = MaterielSourceTypeEnum.PurchasePart,
- // 浣跨敤 ?? 杩愮畻绗︽彁渚涢粯璁ゅ��
- MaterielLength = (float?)Medicat.item_length,
- MaterielWide = (float?)Medicat.item_width,
- MaterielHeight = (float?)Medicat.item_hight,
- MaterielVolume = (float?)Medicat.item_volumn,
- MaterielWeight = (float?)Medicat.item_weight,
- MaterielStoragecondition = float.TryParse(Medicat.storage_confition, out var val) ? val : null, //鍌ㄥ瓨鏉′欢
- Remark = Medicat.remark,
- GoodStatusState = "鏈笅鍙�",
- ModifyDate = Medicat.modify_date
- }).ToList();
- // 涓�娆℃�ф壒閲忔彃鍏ユ暟鎹簱
- BaseDal.Db.Insertable(entityList).ExecuteCommand();
-
- //ProductSynchronous();
- return responseContent.OK("鍚屾鎴愬姛");
- }
-
- catch (Exception ex)
- {
- //SendErrorToUpstream(5, "", ex.Message, "");
- return responseContent.Error(ex.Message);
- }
- }
-
-
- /// <summary>
- /// 鍙戠粰涓嬫父wcs鍚屾鑽搧淇℃伅
- /// </summary>
- /// <returns></returns>
- public WebResponseContent ProductSynchronous()
- {
- try
- {
- //鎶婂皬浠舵湭涓嬪彂鐨勭殑淇℃伅鍜岀瑙勪负0锛屾渶浣庡簱瀛樹负0鐨勮繃婊ゆ帀
- //var list = BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.GoodStatusState == "鏈笅鍙�" && x.MaterielSourceType == MaterielSourceTypeEnum.SelfMadePart).ToList();
- var list = BaseDal.Db.Queryable<Dt_MaterielInfo>().Where(x => x.MaterielSourceType == MaterielSourceTypeEnum.SelfMadePart && x.BoxQty != 0 && x.MinQty != 0 && x.GoodStatusState == "鏈笅鍙�").ToList();
- if (list.Count < 1)
- {
- return new WebResponseContent().OK("鏃犳湭涓嬪彂鑽搧");
- }
- //鎵惧埌浜嗗氨灏嗘暣涓猯ist鍙戠粰涓嬫父绯荤粺
- foreach (var item in list)
- {
- var medicineDTO = new ProductInfo
- {
- //鐢ㄦ埛code
- customerCode = "905",
- //鐗╂枡绫诲瀷
- materialCode = item.MaterielErpType,
- //浜у搧缂栫爜
- productCode = item.MaterielCode,
- //浜у搧鍚�
- productName = item.MaterielName,
- //浜у搧鏉$爜
- productBarCode = item.Barcode,
-
- //鑽墏
- medicine = item.Dosage_form,//杩欓噷瑕佽皟鐢ㄦ柟娉曪紝杞寲鏂规硶
-
- //瑙勬牸
- productSpecifications = item.MaterielSpec,
- //鍗曚綅
- unit = item.MaterielUnit,
- //闀�
- singleProductLongNum = (item.MaterielLength ?? 0).ToString(),
- //瀹�
- singleProductWideNum = (item.MaterielWide ?? 0).ToString(),
- //楂�
- singleProductHighNum = (item.MaterielHeight ?? 0).ToString(),
- //閲嶉噺
- singleProductWeight = (item.MaterielWeight ?? 0).ToString(),
- //浣撶Н
- singleProductVolume = (item.MaterielVolume ?? 0).ToString(),
- //鏄惁鍙栨秷 0鏄笉鍒犻櫎锛�1鍒犻櫎
- isDelete = "0"
- };
- var url = "http://172.16.1.2:9357/file-admin/api/product/productSynchronous";
- var result = HttpHelper.Post(url, medicineDTO.ToJsonString());
- var resp = JsonConvert.DeserializeObject<TowcsResponse<object>>(result);
-
- if (resp != null && resp.code == "0")
- {
- //鏇存柊鑽搧鐘舵��-宸插畬鎴�
- BaseDal.Db.Updateable<Dt_MaterielInfo>()
- .SetColumns(x => x.GoodStatusState == "涓嬪彂瀹屾垚")
- .Where(x => x.MaterielCode == item.MaterielCode)
- .ExecuteCommand();
- }
- else
- {
- //SendErrorToUpstream(5, medicineDTO.materialCode, resp?.msg ?? "WCS鑽搧淇℃伅鍚屾澶辫触", "");
- //return new WebResponseContent { Status = false, Message = "璁㈠崟鎺ㄩ�佸け璐�" };
- continue;
- }
-
- }
- return new WebResponseContent { Status = true, Message = "鎴愬姛" };
- }
- catch (Exception ex)
- {
- Console.WriteLine("ProductSynchronous 寮傚父锛�" + ex.Message);
- return new WebResponseContent { Status = false, Message = ex.Message };
- }
-
- }
/// <summary>
/// 鍚屾鍒犻櫎鍒犻櫎鍟嗗搧淇℃伅
@@ -295,60 +123,7 @@
Console.WriteLine("寮傚父鎺ュ彛鎺ㄩ�佸け璐ワ細" + e.Message);
}
}
- /// <summary>
- /// 鍒涘缓鑽墏瀛楀吀
- /// </summary>
- private static readonly Dictionary<string, string> _dosageFormMap = new Dictionary<string, string>
- {
- {"001", "鐗囧墏"}, {"002", "鐗囧墏"}, {"003", "鐗囧墏"}, {"004", "鐗囧墏"}, {"005", "鐗囧墏"},
- {"006", "鐗囧墏"}, {"007", "鐗囧墏"}, {"008", "鐗囧墏"}, {"009", "鐗囧墏"}, {"010", "鐗囧墏"},
- {"011", "鍏跺畠"}, {"012", "鐗囧墏"}, {"013", "鍏跺畠"}, {"014", "鐗囧墏"}, {"015", "鐗囧墏"},
- {"016", "鐗囧墏"}, {"017", "鐗囧墏"}, {"018", "鍏跺畠"}, {"019", "鍏跺畠"}, {"020", "鍏跺畠"},
- {"021", "閽堝墏"}, {"022", "閽堝墏"}, {"023", "閽堝墏"}, {"024", "閽堝墏"}, {"025", "涓垚鑽�"},
- {"026", "涓垚鑽�"}, {"027", "鍏跺畠"}, {"028", "鍏跺畠"}, {"029", "鍏跺畠"}, {"030", "鍏跺畠"},
- {"031", "鍏跺畠"}, {"032", "鍏跺畠"}, {"033", "鍏跺畠"}, {"034", "涓垚鑽�"}, {"035", "涓垚鑽�"},
- {"036", "涓垚鑽�"}, {"037", "涓垚鑽�"}, {"038", "鍏跺畠"}, {"039", "鍏跺畠"}, {"040", "鍏跺畠"},
- {"041", "涓垚鑽�"}, {"042", "涓垚鑽�"}, {"043", "涓垚鑽�"}, {"044", "鍏跺畠"}, {"045", "涓垚鑽�"},
- {"046", "涓垚鑽�"}, {"047", "涓垚鑽�"}, {"048", "涓垚鑽�"}, {"049", "涓垚鑽�"}, {"050", "涓垚鑽�"},
- {"051", "涓垚鑽�"}, {"052", "涓垚鑽�"}, {"053", "涓垚鑽�"}, {"054", "涓垚鑽�"}, {"055", "涓垚鑽�"},
- {"056", "鍏跺畠"}, {"057", "鍏跺畠"}, {"058", "鍏跺畠"}, {"059", "鍏跺畠"}, {"060", "鍏跺畠"},
- {"061", "鍏跺畠"}, {"062", "鍏跺畠"}, {"063", "鍏跺畠"}, {"064", "鍏跺畠"}, {"065", "鍏跺畠"},
- {"066", "鍏跺畠"}, {"067", "涓垚鑽�"}, {"068", "涓垚鑽�"}, {"069", "涓垚鑽�"}, {"070", "鍏跺畠"},
- {"071", "鍏跺畠"}, {"072", "鍏跺畠"}, {"073", "涓垚鑽�"}, {"074", "鍏跺畠"}, {"075", "鍏跺畠"},
- {"076", "涓垚鑽�"}, {"077", "鍏跺畠"}, {"078", "鍏跺畠"}, {"079", "涓垚鑽�"}, {"080", "涓垚鑽�"},
- {"081", "涓垚鑽�"}, {"082", "涓垚鑽�"}, {"083", "鍏跺畠"}, {"084", "涓垚鑽�"}, {"085", "鍏跺畠"},
- {"086", "涓垚鑽�"}, {"087", "鍏跺畠"}, {"088", "鍏跺畠"}, {"089", "涓垚鑽�"}, {"090", "涓垚鑽�"},
- {"091", "鍏跺畠"}, {"092", "鍏跺畠"}, {"093", "鍏跺畠"}, {"094", "涓垚鑽�"}, {"095", "鍏跺畠"},
- {"096", "鍏跺畠"}, {"097", "鍏跺畠"}, {"098", "鍏跺畠"}, {"099", "鍏跺畠"}, {"100", "鍏跺畠"},
- {"101", "鍏跺畠"}, {"102", "鍏跺畠"}, {"103", "鍏跺畠"}, {"104", "鍏跺畠"}, {"105", "鍏跺畠"},
- {"106", "鍏跺畠"}, {"107", "鍏跺畠"}, {"108", "鍏跺畠"}, {"109", "鍏跺畠"}, {"110", "鍏跺畠"},
- {"111", "鍏跺畠"}, {"112", "鍏跺畠"}, {"113", "鍏跺畠"}, {"114", "鍏跺畠"}, {"115", "鍏跺畠"},
- {"116", "鍏跺畠"}, {"117", "鍏朵粬"}
- };
-
- /// <summary>
- /// 鏍规嵁鍓傚瀷缂栧彿鑾峰彇鍓傚瀷鍒嗙被
- /// </summary>
- /// <param name="dosageCode">鍓傚瀷缂栧彿(001-117)</param>
- /// <returns>鍓傚瀷鍒嗙被(鐗囧墏/閽堝墏/涓垚鑽�/鍏跺畠/鍏朵粬)</returns>
- public static string GetDosageForm(string dosageCode)
- {
- if (string.IsNullOrEmpty(dosageCode))
- return "鏈煡";
-
- // 澶勭悊缂栧彿鏍煎紡锛岀‘淇濇槸3浣嶆暟瀛�
- if (dosageCode.Length == 1)
- dosageCode = "00" + dosageCode;
- else if (dosageCode.Length == 2)
- dosageCode = "0" + dosageCode;
-
- if (_dosageFormMap.TryGetValue(dosageCode, out string form))
- {
- return form;
- }
-
- return "鏈煡";
- }
+
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
new file mode 100644
index 0000000..508891d
--- /dev/null
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/NewBusiness.cs"
@@ -0,0 +1,154 @@
+锘縰sing HslCommunication;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_Core.Helper;
+using WIDESEA_ISquareCabinServices;
+using WIDESEA_Model.Models;
+using static WIDESEA_DTO.SquareCabin.OrderDto;
+
+namespace WIDESEA_SquareCabinServices
+{
+ public partial class Business
+ {
+ #region 鑾峰彇ERP鍏ュ簱鍗�
+ static string SearchInOrderDate = "2025-10-30 00:00:00";
+ public WebResponseContent GetInOrder()
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var url = "http://121.37.118.63:80/GYZ2/95fck/inOrder";
+ if (string.IsNullOrEmpty(SearchInOrderDate)) SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var requestData = new { searchDate = SearchInOrderDate };
+ SearchInOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstreamOrderInfo>>(result);
+ if (response == null || response.resultCode != "0") return content;
+ if (response.data.Count < 1) return content;
+ var ordernos = response.data.Select(x => x.order_no).ToList();
+ var existingOrderNos = _cabinOrderServices.Repository.QueryData(x => ordernos.Contains(x.Order_no)).Select(x => x.Order_no).Distinct().ToList();
+ var newOrders = response.data.Where(order => !existingOrderNos.Contains(order.order_no)).ToList();
+ if (newOrders.Count < 1) return content;
+ foreach (var order in newOrders)
+ {
+ try
+ {
+ if (order.order_type == "1")
+ {
+ _cabinOrderServices.CreateInboundOrder(order);
+ }
+ else if (order.order_type == "3")//鍏ュ簱閫�鏂�
+ {
+ #region 杞崲涓哄嚭搴撳崟
+ UpstramOutOrderInfo upstramOutOrderInfo = new UpstramOutOrderInfo()
+ {
+ order_no = order.order_no,
+ order_type = order.order_type,
+ warehouse_no = order.warehouse_no,
+ details = new List<UpstreamOutOrderDetail>()
+ };
+ foreach (var item in order.details)
+ {
+ UpstreamOutOrderDetail detail = new UpstreamOutOrderDetail()
+ {
+ batch_num = item.batch_num,
+ goods_no = item.goods_no,
+ order_qty = item.order_qty,
+ exp_date = item.exp_date,
+ };
+ upstramOutOrderInfo.details.Add(detail);
+ }
+ _deliveryOrderServices.CreateOutboundOrder(upstramOutOrderInfo);
+ #endregion
+ }
+ else if (order.order_type == "5")//鎶ユ孩鍏ュ簱
+ {
+ _cabinOrderServices.CreateCheckInOrder(order);
+ }
+ }
+ catch (Exception ex)
+ {
+ continue;
+ }
+ }
+ return content.OK();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine("鑾峰彇ERP鍏ュ簱鍗曚俊鎭紓甯革細" + ex.Message);
+ return content.Error(ex.Message);
+ }
+ }
+ #endregion
+
+ #region 鑾峰彇ERP鍑哄簱鍗�
+ static string SearchOutOrderDate = "2025-10-30 00:00:00";
+ public WebResponseContent GetOutOrder()
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var url = "http://121.37.118.63:80/GYZ2/95fck/outOrder";
+ if (string.IsNullOrEmpty(SearchOutOrderDate)) SearchOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var requestData = new { searchDate = SearchOutOrderDate };
+ SearchOutOrderDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+ var result = HttpHelper.Post(url, requestData.ToJsonString());
+ var response = JsonConvert.DeserializeObject<UpstreamResponse<UpstramOutOrderInfo>>(result);
+
+ if (response == null || response.resultCode != "0") return content;
+ if (response.data.Count < 1) return content;
+ var ordernos = response.data.Select(x => x.order_no).ToList();
+ var existingOutOrderNos = _deliveryOrderServices.Repository.QueryData(x => ordernos.Contains(x.Out_no)).Select(x => x.Out_no).Distinct().ToList();
+ var newOutOrders = response.data.Where(outorder => !existingOutOrderNos.Contains(outorder.order_no)).ToList();
+ if (newOutOrders.Count < 1) return content;
+
+ foreach (var outorder in newOutOrders)
+ {
+ if (outorder.order_type == "1")// 姝e父鍑哄簱鍗�
+ {
+ _deliveryOrderServices.CreateOutboundOrder(outorder);
+ }
+ else if (outorder.order_type == "2")//鍑哄簱閫�璐�
+ {
+ #region 杞崲鎴愬叆搴撳崟
+ UpstreamOrderInfo order = new UpstreamOrderInfo()
+ {
+ order_no = outorder.order_no,
+ order_type = outorder.order_type,
+ warehouse_no = outorder.warehouse_no,
+ details = new List<UpstreamOrderDetail>()
+ };
+ foreach (var item in outorder.details)
+ {
+ UpstreamOrderDetail detail = new UpstreamOrderDetail()
+ {
+ batch_num = item.batch_num,
+ goods_no = item.goods_no,
+ order_qty = item.order_qty,
+ exp_date = item.exp_date,
+ };
+ order.details.Add(detail);
+ }
+ #endregion
+ _cabinOrderServices.CreateInboundOrder(order);
+ }
+ else if (outorder.order_type == "6")//鎶ユ崯鍑哄簱
+ {
+ _deliveryOrderServices.CreateCheckOutOrder(outorder);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
+ #endregion
+ }
+}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/AlarmJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/AlarmJob.cs"
index 94b4d60..301f908 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/AlarmJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/AlarmJob.cs"
@@ -19,7 +19,7 @@
_inventoryInfoService = inventoryInfoService;
}
//姣忛殧1绉掓墽琛屼竴娆�
- [Invoke(Begin = "2025-09-01", Interval = 1000 * 10, IsEnabled = true, SkipWhileExecuting = true)]
+ [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
public void Run()
{
//鍐峰簱
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs"
index 5fcdfcc..6e22071 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/CabinOrderController.cs"
@@ -12,9 +12,17 @@
[ApiController]
public class CabinOrderController : ApiBaseController<ICabinOrderServices, Dt_CabinOrder>
{
- public CabinOrderController(ICabinOrderServices service) : base(service)
+ private readonly IBusiness _business;
+ public CabinOrderController(ICabinOrderServices service, IBusiness business) : base(service)
{
+ _business = business;
}
+ [HttpPost, HttpGet, Route("GetUpstreamOrder"), AllowAnonymous]
+ public WebResponseContent GetUpstreamOrder()
+ {
+ return _business.GetUpstreamOrder();
+ }
+
/// <summary>
/// 瀹屾垚鍏ュ簱鍗�
/// </summary>
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/MedicineGoodsController.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/MedicineGoodsController.cs"
index a88ae72..32e2d23 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/MedicineGoodsController.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/SquareCabin/MedicineGoodsController.cs"
@@ -16,11 +16,6 @@
{
}
- [HttpPost,Route("GetMedicineGoodsInfom"),AllowAnonymous]
- public WebResponseContent GetMedicineGoodsInfom()
- {
- return Service.GetMedicineGoodsInfom();
- }
[HttpPost, Route("DeleteProduct"), AllowAnonymous]
public WebResponseContent DeleteProduct(string goodsno)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/WMSInfo/MaterielInfoController.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/WMSInfo/MaterielInfoController.cs"
index 62c2916..df5f69c 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/WMSInfo/MaterielInfoController.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/WMSInfo/MaterielInfoController.cs"
@@ -1,5 +1,7 @@
-锘縰sing Microsoft.AspNetCore.Http;
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
+using WIDESEA_Core;
using WIDESEA_Core.BaseController;
using WIDESEA_IWMsInfoServices;
using WIDESEA_Model.Models;
@@ -13,5 +15,11 @@
public MaterielInfoController(IMaterielInfoService service) : base(service)
{
}
+
+ [HttpPost, Route("GetMedicineGoodsInfom"), AllowAnonymous]
+ public WebResponseContent GetMedicineGoodsInfom()
+ {
+ return Service.GetMedicineGoodsInfom();
+ }
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs"
index a7c3fb9..abdc6ed 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/GoodsJob.cs"
@@ -1,22 +1,23 @@
锘縰sing Pomelo.AspNetCore.TimedJob;
using WIDESEA_ISquareCabinServices;
+using WIDESEA_IWMsInfoServices;
using static WIDESEA_DTO.SquareCabin.TowcsDto;
namespace WIDESEA_WMSServer
{
public class GoodsJob : Job
{
- private readonly IMedicineGoodsServices _medicineGoodsServices;
- public GoodsJob(IMedicineGoodsServices medicineGoodsServices)
+ private readonly IMaterielInfoService _materielInfoService;
+ public GoodsJob(IMaterielInfoService materielInfoService)
{
- _medicineGoodsServices = medicineGoodsServices;
+ _materielInfoService = materielInfoService;
}
//姣忛殧1绉掓墽琛屼竴娆�
- [Invoke(Begin = "2025-09-01", Interval = 1000 * 60, IsEnabled = true, SkipWhileExecuting = true)]
+ [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
public void Run()
{
- _medicineGoodsServices.GetMedicineGoodsInfom();
- _medicineGoodsServices.ProductSynchronous();
+ _materielInfoService.GetMedicineGoodsInfom();
+ _materielInfoService.ProductSynchronous();
Console.WriteLine($"鐗╂枡淇℃伅浠诲姟鎵ц缁撴潫锛歿DateTime.Now}");
}
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
index b7b0004..7bce714 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/InOrderJob.cs"
@@ -11,11 +11,11 @@
_business = business;
}
//姣忛殧1绉掓墽琛屼竴娆�
- [Invoke(Begin = "2025-09-01", Interval = 1000 * 60 * 10, IsEnabled = true, SkipWhileExecuting = true)]
+ [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
public void Run()
{
- _business.GetUpstreamOrder();
- _business.GetUpstreamOutOrder();
+ _business.GetInOrder();
+ _business.GetOutOrder();
//_business.EdiIn();
//_business.CompleteAllOrders();
_business.CompleteAllOrders();
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
index 7865117..03e2ecd 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/OutOrderJob.cs"
@@ -11,7 +11,7 @@
_business = business;
}
//姣忛殧1绉掓墽琛屼竴娆�
- [Invoke(Begin = "2025-09-01", Interval = 1000 * 60, IsEnabled = true, SkipWhileExecuting = true)]
+ [Invoke(Begin = "2025-09-01", Interval = 1000 * 5, IsEnabled = true, SkipWhileExecuting = true)]
public void Run()
{
//鑾峰彇涓婃父鍑哄簱鍗曟暟鎹�
@@ -20,7 +20,7 @@
_business.EdiIn();
_business.EdiOut();
-
+
Console.WriteLine($"WCS浠诲姟鎵ц缁撴潫锛歿DateTime.Now}");
}
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json"
index 417658e..2230e6b 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json"
@@ -16,7 +16,7 @@
//"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=WMS_TC;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//鏃MS鏁版嵁搴撹繛鎺�
- "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDBF_Z22;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+ "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDBF_Z22;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDBF_Z22;User ID=sa;Password=48PYX_h7KS@f;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//璺ㄥ煙
"Cors": {
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/inbound/inboundOrder.js" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/inbound/inboundOrder.js"
index 4b13a4b..692ceca 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/inbound/inboundOrder.js"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WMS/src/extension/inbound/inboundOrder.js"
@@ -27,7 +27,7 @@
const id=rows[0].id
// 杩欓噷娣诲姞浣犵殑涓氬姟閫昏緫
- this.http.post(`/api/CabinOrder/FinishInOrder?key${id}`).then((x) => {
+ this.http.post(`/api/CabinOrder/FinishInOrder?key=${id}`).then((x) => {
if (x.status) {
this.$Message.success('鎿嶄綔鎴愬姛');
this.refresh();
--
Gitblit v1.9.3