| | |
| | | } |
| | | |
| | | else if (process.env.NODE_ENV == 'production') { |
| | | axios.defaults.baseURL = 'http://127.0.0.1:8098/'; |
| | | axios.defaults.baseURL = 'http://115.159.85.185:9291/'; |
| | | } |
| | | if (!axios.defaults.baseURL.endsWith('/')) { |
| | | axios.defaults.baseURL+="/"; |
| | |
| | | </el-table> |
| | | </div> |
| | | <template #footer> |
| | | <el-button type="primary" size="small" @click="outbound">ç´æ¥åºåº</el-button> |
| | | <el-button type="primary" size="small" @click="lockStock">éå®åºå</el-button> |
| | | <el-button type="primary" size="small" @click="outbound" |
| | | >ç´æ¥åºåº</el-button |
| | | > |
| | | <el-button type="primary" size="small" @click="lockStock" |
| | | >éå®åºå</el-button |
| | | > |
| | | <el-button type="danger" size="small" @click="showDetialBox = false" |
| | | >å
³é</el-button |
| | | > |
| | |
| | | this.originalQuantity = this.row.lockQuantity; |
| | | this.selectionSum = this.row.lockQuantity; |
| | | this.getData(); |
| | | if (this.selectionSum == this.row.orderQuantity) { |
| | | this.selectionClass = "equle-style"; |
| | | } else if (this.selectionSum < this.row.orderQuantity) { |
| | | this.selectionClass = "less-style"; |
| | | } else { |
| | | this.selectionClass = "more-style"; |
| | | } |
| | | }, |
| | | lockStock() { |
| | | this.http |
| | |
| | | title="åæ®æç»ä¿¡æ¯" |
| | | > |
| | | <div class="box-head"> |
| | | <!-- <el-row> |
| | | <el-col :span="24"> |
| | | <span>å·²éä¸ {{ true ? 1 : 0 }} 项</span> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <el-button type="text" size="medium" |
| | | ><i class="el-icon-edit">å
³é</i |
| | | ></el-button> |
| | | <el-alert :closable="false" style="width: 100%"> |
| | | <el-row> |
| | | <el-col :span="16"> |
| | | <span>å·²éä¸ {{ selection.length }} 项</span> |
| | | </el-col> |
| | | </el-row> --> |
| | | <el-col :span="8"> |
| | | <el-link |
| | | type="primary" |
| | | size="small" |
| | | style="float: right; height: 20px" |
| | | @click="lockstocks" |
| | | >éå®åºå</el-link |
| | | > |
| | | <el-link |
| | | type="primary" |
| | | size="small" |
| | | style="float: right; height: 20px; margin-right: 10px" |
| | | @click="outbound" |
| | | >ç´æ¥åºåº</el-link |
| | | > |
| | | <el-link |
| | | type="primary" |
| | | size="small" |
| | | style="float: right; height: 20px; margin-right: 10px" |
| | | @click="getData" |
| | | >å·æ°</el-link |
| | | ></el-col |
| | | > |
| | | </el-row> |
| | | </el-alert> |
| | | </div> |
| | | <div class="box-table" style="margin-top: 1%"> |
| | | <el-table |
| | |
| | | highlight-current-row |
| | | @current-change="handleCurrentChange" |
| | | height="500px" |
| | | @row-click="handleRowClick" |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55"> </el-table-column> |
| | | <el-table-column |
| | | label="åºå·" |
| | | type="index" |
| | |
| | | showDetialBox: false, |
| | | flag: false, |
| | | currentRow: null, |
| | | selection: [], |
| | | tableData: [], |
| | | tableColumns: [ |
| | | { |
| | |
| | | this.$refs.selectedStock.open(row); |
| | | } |
| | | }, |
| | | assignStock() {}, |
| | | viewDetail() {}, |
| | | lockstocks() { |
| | | if (this.selection.length === 0) { |
| | | return this.$message.error("è¯·éæ©åæ®æç»"); |
| | | } |
| | | var keys = this.selection.map((item) => item.id); // è·åéä¸è¡çid |
| | | this.http |
| | | .post("api/OutboundOrderDetail/LockOutboundStocks", keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.showDetialBox = false; |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.getData(); |
| | | }); |
| | | }); |
| | | }, |
| | | outbound() { |
| | | if (this.selection.length === 0) { |
| | | return this.$message.error("è¯·éæ©åæ®æç»"); |
| | | } |
| | | var keys = this.selection.map((item) => item.id); // è·åéä¸è¡çid |
| | | |
| | | this.http |
| | | .post("api/Task/GenerateOutboundTasks", keys, "æ°æ®å¤çä¸") |
| | | .then((x) => { |
| | | if (!x.status) return this.$message.error(x.message); |
| | | this.$message.success("æä½æå"); |
| | | this.showDetialBox = false; |
| | | this.$emit("parentCall", ($vue) => { |
| | | $vue.getData(); |
| | | }); |
| | | }); |
| | | }, |
| | | setCurrent(row) { |
| | | this.$refs.singleTable.setCurrentRow(row); |
| | | }, |
| | |
| | | }, |
| | | getButtonEnable(propName, row) { |
| | | if (propName == "assignStock") { |
| | | if (row.orderDetailStatus !== 0 && row.orderDetailStatus !== 60 && row.orderDetailStatus !== 70) { |
| | | if ( |
| | | row.orderDetailStatus !== 0 && |
| | | row.orderDetailStatus !== 60 && |
| | | row.orderDetailStatus !== 70 |
| | | ) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | |
| | | } |
| | | fun(this); |
| | | }, |
| | | handleRowClick(row) { |
| | | this.$refs.singleTable.toggleRowSelection(row); |
| | | }, |
| | | handleSelectionChange(val) { |
| | | this.selection = val; |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | const editFormFields = ref({ |
| | | orderType: "", |
| | | upperOrderNo: "", |
| | | orderStatus: "", |
| | | remark: "", |
| | | }); |
| | | const editFormOptions = ref([ |
| | |
| | | type: "string", |
| | | }, |
| | | { |
| | | title: "åæ®ç¶æ", |
| | | field: "orderStatus", |
| | | type: "select", |
| | | dataKey: "inboundState", |
| | | data: [], |
| | | readonly: true, |
| | | }, |
| | | { |
| | | title: "夿³¨", |
| | | field: "remark", |
| | | type: "textarea", |
| | |
| | | width: 90, |
| | | hidden: true, |
| | | readonly: true, |
| | | require: true, |
| | | align: "left", |
| | | }, |
| | | { |
| | |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | edit: { type: "string" }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "materielName", |
| | |
| | | type: "decimal", |
| | | width: 90, |
| | | align: "left", |
| | | edit: { type: "string" }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "orderQuantity", |
| | |
| | | type: "string", |
| | | width: 90, |
| | | align: "left", |
| | | edit: { type: "number" }, |
| | | required: true, |
| | | }, |
| | | { |
| | | field: "lockQuantity", |
| | |
| | | public AreaInfoService(IAreaInfoRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public IAreaInfoRepository Repository => BaseDal; |
| | | } |
| | | } |
| | |
| | | { nameof(Dt_LocationInfo.Row), OrderByType.Asc }, |
| | | }; |
| | | |
| | | public ILocationInfoRepository Repository => BaseDal; |
| | | |
| | | public LocationInfoService(ILocationInfoRepository BaseDal, IAreaInfoRepository areaInfoRepository, IWarehouseRepository warehouseRepository, IRoadwayInfoRepository roadwayInfoRepository) : base(BaseDal) |
| | | { |
| | | _areaInfoRepository = areaInfoRepository; |
| | |
| | | { |
| | | } |
| | | |
| | | public IMaterielInfoRepository Repository => BaseDal; |
| | | |
| | | public bool ExsitMateriel(string materielCode) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.MaterielCode == materielCode) != null; |
| | |
| | | public RoadwayInfoService(IRoadwayInfoRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public IRoadwayInfoRepository Repository => BaseDal; |
| | | } |
| | | } |
| | |
| | | public WarehouseService(IWarehouseRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public IWarehouseRepository Repository => BaseDal; |
| | | } |
| | | } |
| | |
| | | SequenceAttirbute? sequenceAttirbute = propertyInfo.GetCustomAttribute<SequenceAttirbute>(); |
| | | if (sequenceAttirbute != null) |
| | | { |
| | | if (propertyInfo.GetValue(entityInfo.EntityValue)?.ObjToInt() <= 0) |
| | | { |
| | | SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig |
| | | { |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | |
| | | int seq = sugarClient.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceAttirbute.SequenceName}").ObjToInt(); |
| | | propertyInfo.SetValue(entityInfo.EntityValue, seq, null); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | if (entityInfo.EntityValue is BaseEntity baseEntity) |
| | |
| | | |
| | | namespace WIDESEA_Core.BaseServices |
| | | { |
| | | public interface IService<TEntity> : IDependency where TEntity : class |
| | | public interface IService<TEntity> : IDependency where TEntity : class, new() |
| | | { |
| | | ISqlSugarClient Db { get; } |
| | | |
| | |
| | | return pageGridData; |
| | | } |
| | | |
| | | |
| | | protected string ValidatePageOptions(PageDataOptions options) |
| | | { |
| | | options = options ?? new PageDataOptions(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error("ä¼ åé误,åæ°ä¸è½ä¸ºç©º"); |
| | | } |
| | | string validResult = typeof(TEntity).ValidateDicInEntity(saveModel.MainData, false, TProperties, list?.ToArray()); |
| | | string validResult = typeof(TEntity).ValidateDicInEntity(saveModel.MainData, false, TProperties, list?.ToArray() ?? null); |
| | | |
| | | if (!string.IsNullOrEmpty(validResult)) |
| | | { |
| | |
| | | List<string> listCol = new List<string>(); |
| | | foreach (var item in saveModel.MainData) |
| | | { |
| | | PropertyInfo propertyInfo = typeof(TEntity).GetProperty(item.Key); |
| | | PropertyInfo? propertyInfo = typeof(TEntity).GetProperty(item.Key); |
| | | if (propertyInfo == null) |
| | | { |
| | | propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToLower()); |
| | |
| | | /// <param name="removeNotContains">ç§»é¤ä¸åå¨å段</param> |
| | | /// <param name="removerKey">ç§»é¤ä¸»é®</param> |
| | | /// <returns></returns> |
| | | public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[] ignoreFields = null) |
| | | public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[]? ignoreFields = null) |
| | | { |
| | | if (dic == null || dic.Count == 0) { return "åæ°æ æ"; } |
| | | |
| | |
| | | |
| | | foreach (PropertyInfo property in propertyInfo) |
| | | { |
| | | SugarColumn sugarColumn = property.GetCustomAttribute<SugarColumn>(); |
| | | SugarColumn? sugarColumn = property.GetCustomAttribute<SugarColumn>(); |
| | | if (sugarColumn == null) |
| | | { |
| | | Navigate? navigate = property.GetCustomAttribute<Navigate>(); |
| | | if(navigate != null) |
| | | { |
| | | continue; |
| | | } |
| | | return "请é
ç½®SugarColumn屿§"; |
| | | } |
| | | |
| | | //忽ç¥ä¸ä¸»é®çåæ®µä¸åéªè¯ |
| | | if (property.Name == keyName.FirstLetterToUpper() || (ignoreFields != null && ignoreFields.Contains(property.Name)) || sugarColumn.IsOnlyIgnoreInsert || sugarColumn.IsOnlyIgnoreUpdate || sugarColumn.IsIgnore) |
| | | continue; |
| | | |
| | | //ä¸å¨ç¼è¾ä¸çåï¼æ¯å¦ä¹è¦å¿
å¡« |
| | | if (!dic.ContainsKey(property.Name.FirstLetterToLower())) |
| | | if (!dic.ContainsKey(property.Name.FirstLetterToLower()) /*&& !dic.ContainsKey(property.Name.FirstLetterToUpper())*/) |
| | | { |
| | | if (!sugarColumn.IsNullable) |
| | | { |
| | |
| | | { |
| | | public interface IAreaInfoRepository : IRepository<Dt_AreaInfo> |
| | | { |
| | | /// <summary> |
| | | /// å¯ç¨çåºå主é®éå |
| | | /// </summary> |
| | | public List<int> EnableAreaIds { get; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºéé¢å¯å¨çåºå主é®éå |
| | | /// </summary> |
| | | /// <param name="enableWarehouseIds">ä»åºä¸»é®éå</param> |
| | | /// <returns></returns> |
| | | List<int> GetEnableAreaIds(List<int> enableWarehouseIds); |
| | | } |
| | | } |
| | |
| | | { |
| | | public interface ILocationInfoRepository : IRepository<Dt_LocationInfo> |
| | | { |
| | | /// <summary> |
| | | /// æ ¹æ®å··éè·åææä¸æ·±ãäºæ·±å¯¹åºçä¸ç»è´§ä½æ°æ®éå |
| | | /// </summary> |
| | | /// <param name="roadway">å··éå·</param> |
| | | /// <returns></returns> |
| | | List<LocationGroupDTO> GetAllLocationGroups(string roadway); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®å··éã䏿·±ä½è´§ä½ç¶æãäºæ·±ä½è´§ä½ç¶æè·å对åºçä¸ç»è´§ä½æ°æ®éå |
| | | /// </summary> |
| | | /// <param name="roadway">å··éå·</param> |
| | | /// <param name="locationAStatus">䏿·±ä½è´§ä½ç¶æ</param> |
| | | /// <param name="locationBStatus">äºæ·±ä½è´§ä½ç¶æ</param> |
| | | /// <returns></returns> |
| | | List<LocationGroupDTO> GetLocationGroups(string roadway, LocationStatusEnum locationAStatus, LocationStatusEnum locationBStatus); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®å··éå·éåãåºåéåè·åå¯åºåºçè´§ä½ç¼å·éå |
| | | /// </summary> |
| | | /// <param name="roadways">å··éå·éå</param> |
| | | /// <param name="areaIds">åºåéå</param> |
| | | /// <returns></returns> |
| | | List<string> GetCanOutLocationCodes(List<string> roadways, List<int> areaIds); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®è´§ä½ç¼å·éåè·åè´§ä½å®ä½éå |
| | | /// </summary> |
| | | /// <param name="locationCodes">è´§ä½ç¼å·éå</param> |
| | | /// <returns></returns> |
| | | List<Dt_LocationInfo> GetLocationInfos(List<string> locationCodes); |
| | | |
| | | /// <summary> |
| | | /// æ¹éæ´æ°è´§ä½ç¶æ |
| | | /// </summary> |
| | | /// <param name="locationInfos">è´§ä½å®ä½éå</param> |
| | | /// <param name="locationStatus">è´§ä½ç¶æ</param> |
| | | void UpdateLocationStatus(List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus); |
| | | } |
| | | } |
| | |
| | | { |
| | | public interface IWarehouseRepository : IRepository<Dt_Warehouse> |
| | | { |
| | | /// <summary> |
| | | /// å¯ç¨çä»åºä¸»é®éå |
| | | /// </summary> |
| | | public List<int> EnableWarehouseIds { get; } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | public interface IAreaInfoService : IService<Dt_AreaInfo> |
| | | { |
| | | IAreaInfoRepository Repository { get; } |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | public interface ILocationInfoService : IService<Dt_LocationInfo> |
| | | { |
| | | ILocationInfoRepository Repository { get; } |
| | | |
| | | WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO); |
| | | |
| | | Dt_LocationInfo AdjacentDepthLocation(string locationCode); |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | public interface IMaterielInfoService : IService<Dt_MaterielInfo> |
| | | { |
| | | IMaterielInfoRepository Repository { get; } |
| | | |
| | | bool ExsitMateriel(string materielCode); |
| | | |
| | | bool ExsitMateriels(List<string> materielCodes); |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | public interface IRoadwayInfoService : IService<Dt_RoadwayInfo> |
| | | { |
| | | IRoadwayInfoRepository Repository { get; } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IBasicService |
| | | { |
| | | public interface IWarehouseService : IService<Dt_Warehouse> |
| | | { |
| | | IWarehouseRepository Repository { get; } |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IInboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IInboundService |
| | | { |
| | | public interface IInboundOrderDetailService : IService<Dt_InboundOrderDetail> |
| | | { |
| | | IInboundOrderDetailRepository Repository { get; } |
| | | |
| | | List<Dt_InboundOrderDetail> UpdateReceiptQuantity(List<Dt_InboundOrderDetail> inboundOrderDetails, decimal receiptQuantity); |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_IInboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IInboundService |
| | | { |
| | | public interface IInboundOrderService : IService<Dt_InboundOrder> |
| | | { |
| | | IInboundOrderRepository Repository { get; } |
| | | |
| | | WebResponseContent AddInboundOrder(InboundOrderAddDTO orderAddDTO); |
| | | |
| | | WebResponseContent MaterielGroup(MaterielGroupDTO materielGroupDTO); |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IOutboundService |
| | | { |
| | | public interface IOutStockLockInfoService : IService<Dt_OutStockLockInfo> |
| | | { |
| | | IOutStockLockInfoRepository Repository { get; } |
| | | |
| | | List<Dt_OutStockLockInfo> GetOutStockLockInfos(Dt_OutboundOrder outboundOrder, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_StockInfo> outStocks, int? taskNum = null); |
| | | |
| | | List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId); |
| | | |
| | | List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutStockStatus outStockStatus); |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IOutboundService |
| | | { |
| | | public interface IOutboundOrderDetailService : IService<Dt_OutboundOrderDetail> |
| | | { |
| | | IOutboundOrderDetailRepository Repository { get; } |
| | | |
| | | WebResponseContent LockOutboundStock(int orderDetailId); |
| | | |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews); |
| | | |
| | | WebResponseContent LockOutboundStock(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); |
| | | |
| | | WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock); |
| | | WebResponseContent LockOutboundStock(int[] keys); |
| | | |
| | | WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); |
| | | |
| | | WebResponseContent RevokeLockOutboundStock(int orderDetailId); |
| | | } |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IOutboundService |
| | | { |
| | | public interface IOutboundOrderService : IService<Dt_OutboundOrder> |
| | | { |
| | | IOutboundOrderRepository Repository { get; } |
| | | |
| | | WebResponseContent AddOutboundOrder(OutboundOrderAddDTO orderAddDTO); |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IRecordRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IRecordService |
| | | { |
| | | public interface ILocationStatusChangeRecordSetvice : IService<Dt_LocationStatusChangeRecord> |
| | | { |
| | | ILocationStatusChangeRecordRepository Repository { get; } |
| | | |
| | | void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, int lastStatus, int changeType, string orderNo, int? taskNum); |
| | | |
| | | void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, int newStatus, int changeType, string? orderNo, List<int>? taskNums); |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_IRecordRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IRecordService |
| | | { |
| | | public interface IStockQuantityChangeRecordService : IService<Dt_StockQuantityChangeRecord> |
| | | { |
| | | IStockQuantityChangeRecordRepository Repository { get; } |
| | | |
| | | void AddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType); |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IStockService |
| | | { |
| | | public interface IStockInfoDetailService : IService<Dt_StockInfoDetail> |
| | | { |
| | | IStockInfoDetailRepository Repository { get; } |
| | | |
| | | bool ExistSerialNumber(string SerialNumber); |
| | | |
| | | bool ExistSerialNumbers(List<string> SerialNumbers); |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IStockService |
| | | { |
| | | public interface IStockInfoService : IService<Dt_StockInfo> |
| | | { |
| | | IStockInfoRepository Repository { get; } |
| | | |
| | | Dt_StockInfo? GetStockByPalletCode(string palletCode); |
| | | |
| | | void AddMaterielGroup(Dt_StockInfo stockInfo); |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_ISystemRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_ISystemService |
| | | { |
| | | public interface ISys_DictionaryListService : IService<Sys_DictionaryList> |
| | | { |
| | | ISys_DictionaryListRepository Repository { get; } |
| | | } |
| | | } |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.System; |
| | | using WIDESEA_ISystemRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_ISystemService |
| | | { |
| | | public interface ISys_DictionaryService : IService<Sys_Dictionary> |
| | | { |
| | | ISys_DictionaryRepository Repository { get; } |
| | | |
| | | List<VueDictionaryDTO> GetVueDictionary(string[] dicNos); |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.System; |
| | | using WIDESEA_ISystemRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_ISystemService |
| | | { |
| | | public interface ISys_MenuService : IService<Sys_Menu> |
| | | { |
| | | ISys_MenuRepository Repository { get; } |
| | | |
| | | object GetCurrentMenuActionList(); |
| | | |
| | | List<MenuDTO> GetUserMenuList(int roleId); |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_ISystemRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_ISystemService |
| | | { |
| | | public interface ISys_RoleAuthService : IService<Sys_RoleAuth> |
| | | { |
| | | ISys_RoleAuthRepository Repository { get; } |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.System; |
| | | using WIDESEA_ISystemRepository; |
| | | |
| | | namespace WIDESEA_ISystemService |
| | | { |
| | | public interface ISys_RoleService : IService<Sys_Role> |
| | | { |
| | | ISys_RoleRepository Repository { get; } |
| | | |
| | | List<RoleNodes> GetAllChildren(int roleId); |
| | | |
| | | WebResponseContent GetCurrentTreePermission(); |
| | | |
| | | WebResponseContent GetUserTreePermission(int role_Id); |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_ISystemRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_ISystemService |
| | | { |
| | | public interface ISys_TenantService : IService<Sys_Tenant> |
| | | { |
| | | ISys_TenantRepository Repository { get; } |
| | | |
| | | WebResponseContent InitTenantInfo(string tenantName, int tenantType); |
| | | } |
| | | } |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_ISystemRepository; |
| | | using WIDESEA_Model; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | { |
| | | public interface ISys_UserService : IService<Sys_User> |
| | | { |
| | | ISys_UserRepository Repository { get; } |
| | | |
| | | WebResponseContent Login(LoginInfo loginInfo); |
| | | |
| | | WebResponseContent GetCurrentUserInfo(); |
| | |
| | | { |
| | | public interface ITaskRepository : IRepository<Dt_Task> |
| | | { |
| | | |
| | | int GetTaskNum(string sequenceName); |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_ITaskInfoService |
| | | { |
| | | public interface ITaskService : IService<Dt_Task> |
| | | { |
| | | ITaskRepository Repository { get; } |
| | | |
| | | WebResponseContent GenerateInboundTask(string stationCode, int taskType, string palletCode); |
| | | |
| | | WebResponseContent TaskCompleted(int taskNum); |
| | | |
| | | WebResponseContent GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews); |
| | | |
| | | WebResponseContent GenerateOutboundTask(int[] keys); |
| | | } |
| | | } |
| | |
| | | { |
| | | public class InboundOrderDetailService : ServiceBase<Dt_InboundOrderDetail, IInboundOrderDetailRepository>, IInboundOrderDetailService |
| | | { |
| | | public IInboundOrderDetailRepository Repository => BaseDal; |
| | | |
| | | public InboundOrderDetailService(IInboundOrderDetailRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | |
| | | private readonly IInboundOrderDetailService _inboundOrderDetailService; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | | public IInboundOrderRepository Repository => BaseDal; |
| | | |
| | | public InboundOrderService(IInboundOrderRepository BaseDal, IMapper mapper, IMaterielInfoService materielInfoService, IStockInfoDetailService stockDetailService, IStockInfoService stockInfoService, ITaskRepository taskRepository, IInboundOrderDetailService inboundOrderDetailService, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ·»å åæ® |
| | | /// </summary> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | InboundOrderAddDTO orderAddDTO = saveModel.MainData.DicToModel<InboundOrderAddDTO>(); |
| | |
| | | return AddInboundOrder(orderAddDTO); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ·»å åæ® |
| | | /// </summary> |
| | | /// <param name="orderAddDTO">åæ®æ·»å DTO</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AddInboundOrder(InboundOrderAddDTO orderAddDTO) |
| | | { |
| | | WebResponseContent content = new(); |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éªè¯åæ®æ·»å DTO对象 |
| | | /// </summary> |
| | | /// <param name="inboundOrderAddDTO">åæ®æ·»å DTO</param> |
| | | /// <returns></returns> |
| | | private (bool, string, object?) CheckInboundOrderAddData(InboundOrderAddDTO inboundOrderAddDTO) |
| | | { |
| | | (bool, string, object?) result1 = ModelValidate.ValidateModelData(inboundOrderAddDTO); |
| | |
| | | return (true, "æå", inboundOrderAddDTO); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®å
¥åºåå·è·åå
¥åºå(嫿ç») |
| | | /// </summary> |
| | | /// <param name="inboundOrderNo"></param> |
| | | /// <returns></returns> |
| | | public Dt_InboundOrder GetInboundOrder(string inboundOrderNo) |
| | | { |
| | | return BaseDal.Db.Queryable<Dt_InboundOrder>().Includes(x => x.Details).First(x => x.OrderNo == inboundOrderNo); ; |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç»çæ°æ®æ´æ° |
| | | /// </summary> |
| | | /// <param name="inboundOrder">å
¥åºå</param> |
| | | /// <param name="inboundOrderDetails">å
¥åºåæç»</param> |
| | | /// <param name="stockInfo">ç»çæ°æ®</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent MaterielGroupUpdateData(Dt_InboundOrder inboundOrder, List<Dt_InboundOrderDetail> inboundOrderDetails, Dt_StockInfo stockInfo) |
| | | { |
| | | try |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éªè¯ç»çæ°æ® |
| | | /// </summary> |
| | | /// <param name="materielGroupDTO">ç©æç»çDTO</param> |
| | | /// <param name="matSerialNumberDTOs">æ«ç åºåå·</param> |
| | | /// <param name="materielInfos">ç©æä¿¡æ¯</param> |
| | | /// <param name="materielCodes">ç©æç¼å·</param> |
| | | /// <param name="inboundOrder">å
¥åºåæ®</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯</param> |
| | | /// <returns></returns> |
| | | public (bool, string, object?) CheckMaterielGroupParam(MaterielGroupDTO materielGroupDTO, List<MatSerialNumberDTO> matSerialNumberDTOs, List<Dt_MaterielInfo> materielInfos, List<string> materielCodes, Dt_InboundOrder inboundOrder, Dt_StockInfo stockInfo) |
| | | { |
| | | (bool, string, object?) result = ModelValidate.ValidateModelData(materielGroupDTO); |
| | |
| | | public int Id { get; set; } |
| | | |
| | | [CodeRule(WIDESEA_Core.Enums.RuleCode.OutboundOrderRule)] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·")] |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "åæ®ç¼å·", IsOnlyIgnoreUpdate = true)] |
| | | public string OrderNo { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "䏿¸¸åæ®ç¼å·")] |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "䏿¸¸åæ®ç¼å·", IsOnlyIgnoreUpdate = true)] |
| | | public string UpperOrderNo { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç±»å", IsOnlyIgnoreUpdate = true)] |
| | | public int OrderType { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ®ç¶æ")] |
| | | public int OrderStatus { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å建æ¹å¼")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å建æ¹å¼", IsOnlyIgnoreUpdate = true)] |
| | | public int CreateType { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "夿³¨")] |
| | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_LocationStatusChangeRecord),"è´§ä½ç¶æåå¨è®°å½")] |
| | | public class Dt_LocationStatusChangeRecord |
| | | public class Dt_LocationStatusChangeRecord : BaseEntity |
| | | { |
| | | [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] |
| | | public int Id { get; set; } |
| | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä¼å
级")] |
| | | public int Grade { get; set; } |
| | | |
| | | [SugarColumn(IsNullable = false, DefaultValue = "0", ColumnDescription = "æºä¸»é®")] |
| | | public int SourceKey { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ä¸åæ¶é´ |
| | | /// </summary> |
| | |
| | | { |
| | | public class OutStockLockInfoService : ServiceBase<Dt_OutStockLockInfo, IOutStockLockInfoRepository>, IOutStockLockInfoService |
| | | { |
| | | public IOutStockLockInfoRepository Repository => BaseDal; |
| | | |
| | | public OutStockLockInfoService(IOutStockLockInfoRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | |
| | | |
| | | return outStockLockInfos; |
| | | } |
| | | |
| | | public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId) |
| | | { |
| | | return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId); |
| | | } |
| | | |
| | | public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutStockStatus outStockStatus) |
| | | { |
| | | return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && x.Status == outStockStatus.ObjToInt()); |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public class OutboundOrderDetailService : ServiceBase<Dt_OutboundOrderDetail, IOutboundOrderDetailRepository>, IOutboundOrderDetailService |
| | | { |
| | | private readonly IStockInfoService _stockInfoService; |
| | | private readonly IStockInfoRepository _stockInfoRepository; |
| | | private readonly IStockInfoDetailService _stockInfoDetailService; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | private readonly IOutboundOrderRepository _outboundOrderRepository; |
| | | private readonly IStockInfoDetailRepository _stockInfoDetailRepository; |
| | | private readonly IOutStockLockInfoRepository _outStockLockInfoRepository; |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly ILocationStatusChangeRecordSetvice _locationStatusChangeRecordSetvice; |
| | | private readonly IOutboundOrderService _outboundOrderService; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | |
| | | public OutboundOrderDetailService(IOutboundOrderDetailRepository BaseDal, IStockInfoService stockInfoService, IStockInfoRepository stockInfoRepository, IOutStockLockInfoService outStockLockInfoService, IOutboundOrderRepository outboundOrderRepository, IStockInfoDetailRepository stockInfoDetailRepository, IOutStockLockInfoRepository outStockLockInfoRepository, ILocationInfoRepository locationInfoRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | public IOutboundOrderDetailRepository Repository => BaseDal; |
| | | |
| | | public OutboundOrderDetailService(IOutboundOrderDetailRepository BaseDal, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IUnitOfWorkManage unitOfWorkManage, ILocationStatusChangeRecordSetvice locationStatusChangeRecordSetvice, IOutboundOrderService outboundOrderService, ILocationInfoService locationInfoService, IStockInfoDetailService stockInfoDetailService) : base(BaseDal) |
| | | { |
| | | _stockInfoService = stockInfoService; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _outboundOrderRepository = outboundOrderRepository; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _outStockLockInfoRepository = outStockLockInfoRepository; |
| | | _locationInfoRepository = locationInfoRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _locationStatusChangeRecordSetvice = locationStatusChangeRecordSetvice; |
| | | _outboundOrderService = outboundOrderService; |
| | | _locationInfoService = locationInfoService; |
| | | _stockInfoDetailService = stockInfoDetailService; |
| | | } |
| | | // |
| | | public WebResponseContent LockOutboundStock(int orderDetailId) |
| | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(Dt_OutboundOrderDetail outboundOrderDetail, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); |
| | | (bool, string) result = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); |
| | | if (!result.Item1) throw new Exception(result.Item2); |
| | | (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); |
| | | if (!checkResult.Item1) throw new Exception(checkResult.Item2); |
| | | |
| | | Dt_OutboundOrder outboundOrder = _outboundOrderRepository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); |
| | | Dt_OutboundOrder outboundOrder = _outboundOrderService.Repository.QueryFirst(x => x.Id == outboundOrderDetail.OrderId); |
| | | decimal originalNeedQuantity = outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity; |
| | | |
| | | decimal needQuantity = originalNeedQuantity; |
| | | |
| | | List<Dt_StockInfo> outStocks = _stockInfoRepository.GetStockInfosByPalletCodes(stockSelectViews.Select(x => x.PalletCode).ToList()); |
| | | decimal assignQuantity = stockSelectViews.Sum(x => x.UseableQuantity); |
| | | List<Dt_StockInfo> outStocks = _stockInfoService.Repository.GetStockInfosByPalletCodes(stockSelectViews.Select(x => x.PalletCode).ToList()); |
| | | decimal assignQuantity = 0; |
| | | outStocks.ForEach(x => |
| | | { |
| | | x.Details.ForEach(v => |
| | | { |
| | | assignQuantity += v.StockQuantity - v.OutboundQuantity; |
| | | }); |
| | | }); |
| | | |
| | | outboundOrderDetail.LockQuantity += assignQuantity; |
| | | outStocks.ForEach(x => |
| | | { |
| | |
| | | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outStockLockInfoService.GetOutStockLockInfos(outboundOrder, outboundOrderDetail, outStocks); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList()); |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.GetLocationInfos(outStocks.Select(x => x.LocationCode).ToList()); |
| | | |
| | | return (outStocks, outboundOrderDetail, outStockLockInfos, locationInfos); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = AssignStockOutbound(orderDetailId, stockSelectViews); |
| | | Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == orderDetailId); |
| | | (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); |
| | | if (!checkResult.Item1) throw new Exception(checkResult.Item2); |
| | | |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | WebResponseContent content = LockOutboundStockDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4); |
| | | WebResponseContent content = LockOutboundStockDataUpdate(result.Item1, new List<Dt_OutboundOrderDetail> { result.Item2 }, result.Item3, result.Item4); |
| | | if (content.Status) |
| | | { |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, Dt_OutboundOrderDetail outboundOrderDetail, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock) |
| | | public WebResponseContent LockOutboundStock(int[] keys) |
| | | { |
| | | try |
| | | { |
| | | _stockInfoRepository.UpdateData(stockInfos); |
| | | List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | | List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | foreach (var item in keys) |
| | | { |
| | | Dt_OutboundOrderDetail outboundOrderDetail = BaseDal.QueryFirst(x => x.Id == item); |
| | | (bool, string) checkResult = CheckSelectStockDeital(outboundOrderDetail, stockSelectViews); |
| | | if (!checkResult.Item1) throw new Exception(checkResult.Item2); |
| | | |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | if (result.Item1.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item1); |
| | | outboundOrderDetails.Add(result.Item2); |
| | | outStockLockInfos.AddRange(result.Item3); |
| | | locationInfos.AddRange(result.Item4); |
| | | } |
| | | } |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | WebResponseContent content = LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | if (content.Status) |
| | | { |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_StockInfo> stockInfos, List<Dt_OutboundOrderDetail> outboundOrderDetails, List<Dt_OutStockLockInfo> outStockLockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) |
| | | { |
| | | try |
| | | { |
| | | _stockInfoService.Repository.UpdateData(stockInfos); |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | | foreach (var item in stockInfos) |
| | | { |
| | | stockInfoDetails.AddRange(item.Details); |
| | | } |
| | | _stockInfoDetailRepository.UpdateData(stockInfoDetails); |
| | | BaseDal.UpdateData(outboundOrderDetail); |
| | | _outStockLockInfoRepository.AddData(outStockLockInfos); |
| | | _stockInfoDetailService.Repository.UpdateData(stockInfoDetails); |
| | | BaseDal.UpdateData(outboundOrderDetails); |
| | | |
| | | _locationInfoRepository.UpdateLocationStatus(locationInfos, locationStatus); |
| | | List<Dt_OutStockLockInfo> addOutStockLockInfos = outStockLockInfos.Where(x => x.Id == 0).ToList(); |
| | | if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) |
| | | { |
| | | _outStockLockInfoService.Repository.AddData(addOutStockLockInfos); |
| | | } |
| | | List<Dt_OutStockLockInfo> updateOutStockLockInfos = outStockLockInfos.Where(x => x.Id > 0).ToList(); |
| | | if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) |
| | | { |
| | | _outStockLockInfoService.Repository.UpdateData(updateOutStockLockInfos); |
| | | } |
| | | |
| | | _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus.ObjToInt(), StockChangeType.Outbound.ObjToInt(), "", tasks?.Select(x => x.TaskNum).ToList()); |
| | | _locationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | |
| | | (bool, string) result = CheckRevoke(outboundOrderDetail); |
| | | if (!result.Item1) return WebResponseContent.Instance.Error(result.Item2); |
| | | |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outStockLockInfoService.GetByOrderDetailId(orderDetailId); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = _outStockLockInfoService.GetByOrderDetailId(orderDetailId, OutStockStatus.å·²åé
); |
| | | if (outStockLockInfos.Count > 0) |
| | | { |
| | | List<Dt_StockInfo> stocks = _stockInfoRepository.GetStockInfosByPalletCodes(outStockLockInfos.Select(x => x.PalletCode).ToList()); |
| | | List<Dt_StockInfo> stocks = _stockInfoService.Repository.GetStockInfosByPalletCodes(outStockLockInfos.Select(x => x.PalletCode).ToList()); |
| | | if (stocks.Count > 0) |
| | | { |
| | | stocks.ForEach(x => |
| | |
| | | x.Status = OutStockStatus.æ¤é.ObjToInt(); |
| | | }); |
| | | |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetLocationInfos(stocks.Select(x => x.LocationCode).ToList()); |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.GetLocationInfos(stocks.Select(x => x.LocationCode).ToList()); |
| | | |
| | | return LockOutboundStockDataUpdate(stocks, outboundOrderDetail, outStockLockInfos, locationInfos, LocationStatusEnum.InStock); |
| | | return LockOutboundStockDataUpdate(stocks, new List<Dt_OutboundOrderDetail> { outboundOrderDetail }, outStockLockInfos, locationInfos, LocationStatusEnum.InStock); |
| | | } |
| | | return WebResponseContent.Instance.Error("æªæ¾å°åºåä¿¡æ¯"); |
| | | } |
| | |
| | | using AutoMapper; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Serialization; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | private readonly IStockInfoService _stockInfoService; |
| | | private readonly IStockInfoDetailService _stockDetailService; |
| | | |
| | | public IOutboundOrderRepository Repository => BaseDal; |
| | | |
| | | public OutboundOrderService(IOutboundOrderRepository BaseDal, IMapper mapper, IMaterielInfoService materielInfoService, IStockInfoDetailService stockDetailService, IStockInfoService stockInfoService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | OutboundOrderAddDTO outboundOrder = saveModel.MainData.DicToModel<OutboundOrderAddDTO>(); |
| | | outboundOrder.Details = saveModel.DetailData.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | List<OutboundOrderDetailAddDTO> orderDetailAddDTOs = saveModel.DetailData.DicToIEnumerable<OutboundOrderDetailAddDTO>(); |
| | | outboundOrder.Details = orderDetailAddDTOs.GroupBy(x => x.MaterielCode).Select(x => new OutboundOrderDetailAddDTO |
| | | { |
| | | BatchNo = x.FirstOrDefault()?.BatchNo ?? "", |
| | | MaterielCode = x.Key, |
| | | OrderQuantity = x.Sum(x => x.OrderQuantity), |
| | | Remark = x.FirstOrDefault(v => !string.IsNullOrEmpty(v.Remark))?.Remark ?? "" |
| | | }).ToList(); |
| | | return AddOutboundOrder(outboundOrder); |
| | | } |
| | | |
| | | public override WebResponseContent UpdateData(SaveModel saveModel) |
| | | { |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = saveModel.DetailData.DicToIEnumerable<Dt_OutboundOrderDetail>(); |
| | | if (outboundOrderDetails.GroupBy(x => x.MaterielCode).Select(x => x.Count()).Any(x => x > 1)) |
| | | { |
| | | return WebResponseContent.Instance.Error("ç©æéå¤"); |
| | | } |
| | | outboundOrderDetails = outboundOrderDetails.Where(x => (x.Id > 0 && x.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) || x.Id == 0).ToList(); |
| | | |
| | | List<Dictionary<string, object>> dics = new List<Dictionary<string, object>>(); |
| | | JsonSerializerSettings settings = new JsonSerializerSettings(); |
| | | settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); |
| | | foreach (var item in outboundOrderDetails) |
| | | { |
| | | string str = JsonConvert.SerializeObject(item, settings); |
| | | Dictionary<string, object>? dic = JsonConvert.DeserializeObject<Dictionary<string, object>>(str); |
| | | if (dic != null) |
| | | dics.Add(dic); |
| | | } |
| | | saveModel.DetailData = dics; |
| | | return base.UpdateData(saveModel); |
| | | } |
| | | |
| | | public WebResponseContent AddOutboundOrder(OutboundOrderAddDTO orderAddDTO) |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IStockService\WIDESEA_IStockService.csproj" /> |
| | | </ItemGroup> |
| | | |
| | |
| | | { |
| | | } |
| | | |
| | | public ILocationStatusChangeRecordRepository Repository => BaseDal; |
| | | |
| | | public void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, int lastStatus, int changeType, string? orderNo, int? taskNum) |
| | | { |
| | | Dt_LocationStatusChangeRecord locationStatusChangeRecord = new Dt_LocationStatusChangeRecord() |
| | |
| | | _mapper = mapper; |
| | | } |
| | | |
| | | public IStockQuantityChangeRecordRepository Repository => BaseDal; |
| | | |
| | | public void AddStockChangeRecord(Dt_StockInfo stockInfo, List<Dt_StockInfoDetail> stockInfoDetails, decimal beforeQuantity, decimal totalQuantity, StockChangeType changeType) |
| | | { |
| | | List<Dt_StockQuantityChangeRecord> stockQuantityChangeRecords = new List<Dt_StockQuantityChangeRecord>(); |
| | |
| | | { |
| | | } |
| | | |
| | | public IStockInfoDetailRepository Repository => BaseDal; |
| | | |
| | | public bool ExistSerialNumber(string SerialNumber) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.SerialNumber == SerialNumber) != null; |
| | |
| | | private readonly IAreaInfoRepository _areaInfoRepository; |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | |
| | | public IStockInfoRepository Repository => BaseDal; |
| | | |
| | | public StockInfoService(IStockInfoRepository BaseDal, IMapper mapper, IStockQuantityChangeRecordService stockQuantityChangeRecordService, IStockInfoDetailRepository stockInfoDetailRepository, IWarehouseRepository warehouseRepository, IRoadwayInfoRepository roadwayInfoRepository, IAreaInfoRepository areaInfoRepository, ILocationInfoRepository locationInfoRepository) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | |
| | | public Sys_DictionaryListService(ISys_DictionaryListRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public ISys_DictionaryListRepository Repository => BaseDal; |
| | | } |
| | | } |
| | |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | |
| | | public ISys_DictionaryRepository Repository => BaseDal; |
| | | |
| | | public List<VueDictionaryDTO> GetVueDictionary(string[] dicNos) |
| | | { |
| | | if (dicNos == null || dicNos.Count() == 0) return new List<VueDictionaryDTO>(); |
| | |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | | public ISys_MenuRepository Repository => BaseDal; |
| | | |
| | | public Sys_MenuService(ISys_MenuRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | public Sys_RoleAuthService(ISys_RoleAuthRepository BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public ISys_RoleAuthRepository Repository => BaseDal; |
| | | } |
| | | } |
| | |
| | | private readonly ISys_MenuRepository _MenuRepository; |
| | | private readonly ISys_MenuService _MenuService; |
| | | private readonly ISys_RoleAuthRepository _RoleAuthRepository; |
| | | |
| | | public ISys_RoleRepository Repository => BaseDal; |
| | | |
| | | public Sys_RoleService(ISys_RoleRepository BaseDal, ISys_MenuRepository MenuRepository, ISys_MenuService MenuService, ISys_RoleAuthRepository roleAuthRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | public class Sys_TenantService : ServiceBase<Sys_Tenant, ISys_TenantRepository>, ISys_TenantService |
| | | { |
| | | private IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | | public ISys_TenantRepository Repository => BaseDal; |
| | | |
| | | public Sys_TenantService(ISys_TenantRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly ICacheService _cacheService; |
| | | |
| | | public ISys_UserRepository Repository => BaseDal; |
| | | |
| | | public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService) : base(repository) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Attributes; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | { |
| | | } |
| | | |
| | | public int GetTaskNum(string sequenceName) |
| | | { |
| | | return Db.Ado.GetScalar($"SELECT NEXT VALUE FOR {sequenceName}").ObjToInt(); |
| | | } |
| | | |
| | | public override int AddData(Dt_Task entity) |
| | | { |
| | | return base.AddData(entity); |
| | | } |
| | | |
| | | public override int AddData(List<Dt_Task> listEntity) |
| | | { |
| | | if (listEntity.GroupBy(x => x.PalletCode).Select(x => x.Count()).Any(x => x > 1)) |
| | | { |
| | | throw new Exception("任塿°ç»æ°æ®æçå·éå¤"); |
| | | } |
| | | |
| | | if (QueryFirst(x => listEntity.Select(v => v.PalletCode).Contains(x.PalletCode)) != null) |
| | | { |
| | | throw new Exception("æéå¤ä»»å¡"); |
| | | } |
| | | |
| | | return base.AddData(listEntity); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Core.Helper; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | /// <summary> |
| | | /// PDAç³è¯·å
¥åº--å åæºç«åºå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="taskType">ä»»å¡ç±»å--å
¥ç©ºï¼å
¥æ</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent GenerateInboundTask(string stationCode, int taskType, string palletCode) |
| | | { |
| | | string? name = Enum.GetName(typeof(TaskTypeEnum), taskType); |
| | | MethodInfo? methodInfo = GetType().GetMethod(name + "Request"); |
| | | if (methodInfo != null) |
| | | { |
| | | WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { stationCode, palletCode }); |
| | | if (responseContent != null) |
| | | { |
| | | return responseContent; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥ä»»å¡ç±»åä¸å¡"); |
| | | } |
| | | return WebResponseContent.Instance.Error("é误"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent PalletInboundRequest(string stationCode, string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | (bool, string) result = CheckRequestInbound(stationCode, palletCode, false); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | content = AssignLocUpdateData(stationCode, TaskTypeEnum.PalletInbound.ObjToInt(), palletCode, false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç©æå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent InboundRequest(string stationCode, string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockInfoService.Repository.GetStockInfo(palletCode); |
| | | (bool, string) result = CheckRequestInbound(stationCode, palletCode, true, stockInfo); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | content = AssignLocUpdateData(stationCode, TaskTypeEnum.Inbound.ObjToInt(), palletCode, true, stockInfo); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåé
è´§ä½åå¤çæ°æ® |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="taskType">ä»»å¡ç±»å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <param name="isUpdateStock">æ¯å¦æ´æ°ç»çä¿¡æ¯--åºåç©æå
¥åºå空æå
¥åº</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯--å¯ç©º</param> |
| | | /// <param name="orderNo">订åå·--å¯ç©º</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | private WebResponseContent AssignLocUpdateData(string stationCode, int taskType, string palletCode, bool isUpdateStock = true, Dt_StockInfo? stockInfo = null, string orderNo = "") |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(stationCode, taskType); |
| | | if (locationInfo != null) |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | PalletCode = palletCode, |
| | | NextAddress = locationInfo.LocationCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskType = taskType, |
| | | }; |
| | | BaseDal.AddData(task); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt(); |
| | | if (isUpdateStock) |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Count > 0) |
| | | { |
| | | orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | _stockInfoService.Repository.UpdateData(stockInfo); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°åºåä¿¡æ¯"); |
| | | } |
| | | } |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum); |
| | | |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éªè¯æ°æ® |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <param name="isCheckStock">æ¯å¦æ£æ¥ç»çä¿¡æ¯--åºåç©æå
¥åºå空æå
¥åº</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯--å¯ç©º</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | private (bool, string) CheckRequestInbound(string stationCode, string palletCode, bool isCheckStock = true, Dt_StockInfo? stockInfo = null) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.PalletCode == palletCode) != null) |
| | | { |
| | | return (false, "该æçå·å·²æä»»å¡"); |
| | | } |
| | | if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.InNew.ObjToInt()) != null) |
| | | { |
| | | return (false, "å½åå
¥åºç«å°å·²æä¸æ¡æ°å»ºä»»å¡"); |
| | | } |
| | | if (isCheckStock) |
| | | { |
| | | if (stockInfo == null) |
| | | { |
| | | return (false, "æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt()) |
| | | { |
| | | return (false, "该ç»çç¶æä¸å¯å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return (false, "该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | if (stockInfo.Details == null || stockInfo.Details.Count == 0) |
| | | { |
| | | return (false, "没æåºåæç»ä¿¡æ¯"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (_stockInfoService.Repository.QueryFirst(x => x.PalletCode == palletCode) != null) |
| | | { |
| | | return (false, "该æçå·²åå¨åºå
"); |
| | | } |
| | | } |
| | | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åºå®æå¤ç |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½å¯¹è±¡</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent PalletInboundTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | PalletCode = task.PalletCode, |
| | | LocationCode = task.TargetAddress, |
| | | StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt() |
| | | }; |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | CheckInboundCompleted(stockInfo, locationInfo); |
| | | |
| | | _stockInfoService.Repository.AddData(stockInfo); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | |
| | | BaseDal.DeleteData(task); |
| | | |
| | | _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Core.Helper; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_StockInfo stockInfo = stockInfos[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | Dt_RoadwayInfo roadwayInfo = _roadwayInfoRepository.QueryFirst(x => x.RoadwayNo == locationInfo.RoadwayNo); |
| | | if (roadwayInfo != null) |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = roadwayInfo.OutSCStationCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = roadwayInfo.OutStationCode, |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum("SeqTaskNum") |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | | } |
| | | return tasks; |
| | | } |
| | | |
| | | public (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) OutboundTaskDataHandle(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | Dt_OutboundOrderDetail outboundOrderDetail = _outboundOrderDetailService.Repository.QueryFirst(x => x.Id == orderDetailId); |
| | | |
| | | if (outboundOrderDetail == null) |
| | | { |
| | | throw new Exception("æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | |
| | | if (stockSelectViews.Sum(x => x.UseableQuantity) > outboundOrderDetail.OrderQuantity - outboundOrderDetail.LockQuantity) |
| | | { |
| | | throw new Exception("éæ©æ°éè¶
åºåæ®æ°é"); |
| | | } |
| | | List<Dt_StockInfo>? stockInfos = null; |
| | | Dt_OutboundOrderDetail? orderDetail = null; |
| | | List<Dt_OutStockLockInfo>? outStockLockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt()) |
| | | { |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks = GetTasks(result.Item1); |
| | | result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutStockStatus.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | stockInfos = result.Item1; |
| | | orderDetail = result.Item2; |
| | | outStockLockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ åºå"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | List<Dt_OutStockLockInfo> stockLockInfos = _outStockLockInfoService.GetByOrderDetailId(outboundOrderDetail.OrderId); |
| | | if (stockLockInfos != null && stockLockInfos.Count > 0) |
| | | { |
| | | List<Dt_StockInfo> stocks = _stockInfoService.Repository.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList()); |
| | | tasks = GetTasks(stocks); |
| | | } |
| | | } |
| | | |
| | | return (tasks, stockInfos, orderDetail == null ? null : new List<Dt_OutboundOrderDetail> { orderDetail }, outStockLockInfos, locationInfos); |
| | | } |
| | | |
| | | public WebResponseContent GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | try |
| | | { |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(orderDetailId, stockSelectViews); |
| | | |
| | | WebResponseContent content = GenerateOutboundTaskDataUpdate(result.Item1, result.Item2, result.Item3, result.Item4, result.Item5); |
| | | |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_StockInfo>? stockInfos = null, List<Dt_OutboundOrderDetail>? outboundOrderDetails = null, List<Dt_OutStockLockInfo>? outStockLockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | BaseDal.AddData(tasks); |
| | | if (stockInfos != null && outboundOrderDetails != null && outStockLockInfos != null && locationInfos != null) |
| | | { |
| | | WebResponseContent content = _outboundOrderDetailService.LockOutboundStockDataUpdate(stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (content.Status) |
| | | { |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | return content; |
| | | } |
| | | else if (outboundOrderDetails != null && outboundOrderDetails.Count > 0) |
| | | { |
| | | outboundOrderDetails.ForEach(x => |
| | | { |
| | | x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | }); |
| | | |
| | | _outboundOrderDetailService.Repository.UpdateData(outboundOrderDetails); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | |
| | | public WebResponseContent GenerateOutboundTask(int[] keys) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | | List<Dt_StockInfo> stockInfos = new List<Dt_StockInfo>(); |
| | | List<Dt_OutboundOrderDetail> outboundOrderDetails = new List<Dt_OutboundOrderDetail>(); |
| | | List<Dt_OutStockLockInfo> outStockLockInfos = new List<Dt_OutStockLockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | foreach (int key in keys) |
| | | { |
| | | (List<Dt_Task>, List<Dt_StockInfo>?, List<Dt_OutboundOrderDetail>?, List<Dt_OutStockLockInfo>?, List<Dt_LocationInfo>?) result = OutboundTaskDataHandle(key, stockSelectViews); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | stockInfos.AddRange(result.Item2); |
| | | } |
| | | if (result.Item3 != null && result.Item3.Count > 0) |
| | | { |
| | | outboundOrderDetails.AddRange(result.Item3); |
| | | } |
| | | if (result.Item4 != null && result.Item4.Count > 0) |
| | | { |
| | | outStockLockInfos.AddRange(result.Item4); |
| | | } |
| | | if (result.Item5 != null && result.Item5.Count > 0) |
| | | { |
| | | locationInfos.AddRange(result.Item5); |
| | | } |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | } |
| | | |
| | | WebResponseContent content = GenerateOutboundTaskDataUpdate(tasks, stockInfos, outboundOrderDetails, outStockLockInfos, locationInfos); |
| | | return content; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public class TaskService : ServiceBase<Dt_Task, ITaskRepository>, ITaskService |
| | | public partial class TaskService : ServiceBase<Dt_Task, ITaskRepository>, ITaskService |
| | | { |
| | | private readonly IMapper _mapper; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly ILocationInfoService _locationInfoService; |
| | | private readonly ILocationInfoRepository _locationInfoRepository; |
| | | private readonly IStockInfoRepository _stockInfoRepository; |
| | | private readonly IStockInfoService _stockInfoService; |
| | | private readonly ILocationStatusChangeRecordSetvice _locationStatusChangeRecordSetvice; |
| | | private readonly IOutboundOrderDetailService _outboundOrderDetailService; |
| | | private readonly IRoadwayInfoRepository _roadwayInfoRepository; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, ILocationInfoService locationInfoService, ILocationInfoRepository locationInfoRepository, IStockInfoRepository stockInfoRepository, ILocationStatusChangeRecordSetvice locationStatusChangeRecordSetvice, IOutboundOrderDetailService outboundOrderDetailService, IRoadwayInfoRepository roadwayInfoRepository) : base(BaseDal) |
| | | public ITaskRepository Repository => BaseDal; |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, ILocationInfoService locationInfoService, IStockInfoRepository stockInfoRepository, ILocationStatusChangeRecordSetvice locationStatusChangeRecordSetvice, IOutboundOrderDetailService outboundOrderDetailService, IRoadwayInfoRepository roadwayInfoRepository, IOutStockLockInfoService outStockLockInfoService, IStockInfoService stockInfoService) : base(BaseDal) |
| | | { |
| | | _mapper = mapper; |
| | | _locationInfoService = locationInfoService; |
| | | _locationInfoRepository = locationInfoRepository; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _stockInfoService = stockInfoService; |
| | | _locationStatusChangeRecordSetvice = locationStatusChangeRecordSetvice; |
| | | _outboundOrderDetailService = outboundOrderDetailService; |
| | | _roadwayInfoRepository = roadwayInfoRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// PDAç³è¯·å
¥åº--å åæºç«åºå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="taskType">ä»»å¡ç±»å--å
¥ç©ºï¼å
¥æ</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent GenerateInboundTask(string stationCode, int taskType, string palletCode) |
| | | { |
| | | string? name = Enum.GetName(typeof(TaskTypeEnum), taskType); |
| | | MethodInfo? methodInfo = GetType().GetMethod(name + "Request"); |
| | | if (methodInfo != null) |
| | | { |
| | | WebResponseContent? responseContent = (WebResponseContent?)methodInfo.Invoke(this, new object[] { stationCode, palletCode }); |
| | | if (responseContent != null) |
| | | { |
| | | return responseContent; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error("æªæ¾å°è¯¥ä»»å¡ç±»åä¸å¡"); |
| | | } |
| | | return WebResponseContent.Instance.Error("é误"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent PalletInboundRequest(string stationCode, string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | (bool, string) result = CheckRequestInbound(stationCode, palletCode, false); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | content = AssignLocUpdateData(stationCode, TaskTypeEnum.PalletInbound.ObjToInt(), palletCode, false); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç©æå
¥åº |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent InboundRequest(string stationCode, string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StockInfo stockInfo = _stockInfoRepository.GetStockInfo(palletCode); |
| | | (bool, string) result = CheckRequestInbound(stationCode, palletCode, true, stockInfo); |
| | | if (!result.Item1) return content = WebResponseContent.Instance.Error(result.Item2); |
| | | content = AssignLocUpdateData(stationCode, TaskTypeEnum.Inbound.ObjToInt(), palletCode, true, stockInfo); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºåé
è´§ä½åå¤çæ°æ® |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="taskType">ä»»å¡ç±»å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <param name="isUpdateStock">æ¯å¦æ´æ°ç»çä¿¡æ¯--åºåç©æå
¥åºå空æå
¥åº</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯--å¯ç©º</param> |
| | | /// <param name="orderNo">订åå·--å¯ç©º</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | private WebResponseContent AssignLocUpdateData(string stationCode, int taskType, string palletCode, bool isUpdateStock = true, Dt_StockInfo? stockInfo = null, string orderNo = "") |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_LocationInfo? locationInfo = _locationInfoService.AssignLocation(stationCode, taskType); |
| | | if (locationInfo != null) |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | PalletCode = palletCode, |
| | | NextAddress = locationInfo.LocationCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stationCode, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskType = taskType, |
| | | }; |
| | | BaseDal.AddData(task); |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt(); |
| | | if (isUpdateStock) |
| | | { |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Count > 0) |
| | | { |
| | | orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | _stockInfoRepository.UpdateData(stockInfo); |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°åºåä¿¡æ¯"); |
| | | } |
| | | } |
| | | _locationInfoRepository.UpdateData(locationInfo); |
| | | _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum); |
| | | |
| | | return content = WebResponseContent.Instance.OK(); |
| | | } |
| | | return content = WebResponseContent.Instance.Error("æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éªè¯æ°æ® |
| | | /// </summary> |
| | | /// <param name="stationCode">èµ·å§å°å</param> |
| | | /// <param name="palletCode">æçç¼å·</param> |
| | | /// <param name="isCheckStock">æ¯å¦æ£æ¥ç»çä¿¡æ¯--åºåç©æå
¥åºå空æå
¥åº</param> |
| | | /// <param name="stockInfo">ç»çä¿¡æ¯--å¯ç©º</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | private (bool, string) CheckRequestInbound(string stationCode, string palletCode, bool isCheckStock = true, Dt_StockInfo? stockInfo = null) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.PalletCode == palletCode) != null) |
| | | { |
| | | return (false, "该æçå·å·²æä»»å¡"); |
| | | } |
| | | if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.InNew.ObjToInt()) != null) |
| | | { |
| | | return (false, "å½åå
¥åºç«å°å·²æä¸æ¡æ°å»ºä»»å¡"); |
| | | } |
| | | if (isCheckStock) |
| | | { |
| | | if (stockInfo == null) |
| | | { |
| | | return (false, "æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt()) |
| | | { |
| | | return (false, "该ç»çç¶æä¸å¯å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return (false, "该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | if (stockInfo.Details == null || stockInfo.Details.Count == 0) |
| | | { |
| | | return (false, "没æåºåæç»ä¿¡æ¯"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (_stockInfoRepository.QueryFirst(x => x.PalletCode == palletCode) != null) |
| | | { |
| | | return (false, "该æçå·²åå¨åºå
"); |
| | | } |
| | | } |
| | | |
| | | return (true, "æå"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æçå
¥åºå®æå¤ç |
| | | /// </summary> |
| | | /// <param name="task">ä»»å¡å®ä½å¯¹è±¡</param> |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | public WebResponseContent PalletInboundTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | PalletCode = task.PalletCode, |
| | | LocationCode = task.TargetAddress, |
| | | StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt() |
| | | }; |
| | | Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | CheckInboundCompleted(stockInfo, locationInfo); |
| | | |
| | | _stockInfoRepository.AddData(stockInfo); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | _locationInfoRepository.UpdateData(locationInfo); |
| | | |
| | | |
| | | BaseDal.DeleteData(task); |
| | | |
| | | _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | } |
| | | |
| | | public WebResponseContent InboundTaskCompleted(Dt_Task task) |
| | | { |
| | | Dt_StockInfo stockInfo = _stockInfoRepository.GetStockInfo(task.PalletCode); |
| | | Dt_StockInfo stockInfo = _stockInfoService.Repository.GetStockInfo(task.PalletCode); |
| | | |
| | | Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | Dt_LocationInfo locationInfo = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | CheckInboundCompleted(stockInfo, locationInfo); |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | stockInfo.StockStatus = StockStatusEmun.å·²å
¥åº.ObjToInt(); |
| | | _stockInfoRepository.UpdateData(stockInfo); |
| | | _stockInfoService.Repository.UpdateData(stockInfo); |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt(); |
| | | _locationInfoRepository.UpdateData(locationInfo); |
| | | _locationInfoService.Repository.UpdateData(locationInfo); |
| | | |
| | | BaseDal.DeleteData(task); |
| | | |
| | |
| | | return WebResponseContent.Instance.Error(); |
| | | } |
| | | |
| | | public WebResponseContent GenerateOutboundTask(int orderDetailId, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | try |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundOrderDetailService.AssignStockOutbound(orderDetailId, stockSelectViews); |
| | | for (int i = 0; i < result.Item1.Count; i++) |
| | | { |
| | | Dt_StockInfo stockInfo = result.Item1[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _locationInfoRepository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | Dt_RoadwayInfo roadwayInfo = _roadwayInfoRepository.QueryFirst(x => x.RoadwayNo == locationInfo.RoadwayNo); |
| | | if (roadwayInfo != null) |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = roadwayInfo.OutSCStationCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = roadwayInfo.OutStationCode, |
| | | TaskStatus = InTaskStatusEnum.InNew.ObjToInt(), |
| | | TaskType = TaskTypeEnum.Outbound.ObjToInt(), |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | | } |
| | | result.Item2.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutStockStatus.åºåºä¸.ObjToInt(); |
| | | }); |
| | | List<Dt_LocationInfo> locationInfos = _locationInfoRepository.GetLocationInfos(result.Item3.Select(x => x.LocationCode).ToList()); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | BaseDal.AddData(tasks); |
| | | _outboundOrderDetailService.LockOutboundStockDataUpdate(result.Item1, result.Item2, result.Item3, locationInfos); |
| | | _locationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, LocationStatusEnum.Lock.ObjToInt(), StockChangeType.Outbound.ObjToInt(), "", tasks.Select(x => x.TaskNum).ToList()); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | <Project Sdk="Microsoft.NET.Sdk"> |
| | | |
| | | <PropertyGroup> |
| | | <TargetFramework>net6.0</TargetFramework> |
| | |
| | | <ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IStockRepository\WIDESEA_IStockRepository.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_IStockService\WIDESEA_IStockService.csproj" /> |
| | | <ProjectReference Include="..\WIDESEA_ITaskInfoService\WIDESEA_ITaskInfoService.csproj" /> |
| | | </ItemGroup> |
| | | |
| | |
| | | return Service.LockOutboundStock(id, stockSelectViews); |
| | | } |
| | | |
| | | [HttpPost, Route("LockOutboundStocks")] |
| | | public WebResponseContent LockOutboundStocks([FromBody] int[] keys) |
| | | { |
| | | return Service.LockOutboundStock(keys); |
| | | } |
| | | |
| | | [HttpPost, Route("RevokeLockOutboundStock")] |
| | | public WebResponseContent RevokeLockOutboundStock(int id) |
| | | { |
| | | return Service.RevokeLockOutboundStock(id); |
| | | } |
| | | |
| | | [HttpPost, Route("AssignStockOutbound")] |
| | | public (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) AssignStockOutbound(int orderDetailId, [FromBody] List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | return Service.AssignStockOutbound(orderDetailId, stockSelectViews); |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Authorization; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_Core.Caches; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.HttpContextUser; |
| | |
| | | public class Sys_UserController : ApiBaseController<ISys_UserService, Sys_User> |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | private readonly ICacheService _cacheService; |
| | | |
| | | public Sys_UserController(ISys_UserService userService, IHttpContextAccessor httpContextAccessor) : base(userService) |
| | | public Sys_UserController(ISys_UserService userService, IHttpContextAccessor httpContextAccessor, ICacheService cacheService) : base(userService) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _cacheService = cacheService; |
| | | } |
| | | |
| | | [HttpPost, Route("login"), AllowAnonymous] |
| | |
| | | UserName = App.User.UserName |
| | | }; |
| | | string newToken = JwtHelper.IssueJwt(tokenModelJwt); |
| | | _cacheService.AddOrUpdate(tokenModelJwt.UserId.ToString(), newToken); |
| | | return responseContent = WebResponseContent.Instance.OK(data: newToken); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | } |
| | | |
| | | [HttpPost, Route("GenerateInboundTask"), AllowAnonymous] |
| | | [HttpPost, Route("GenerateInboundTask")] |
| | | public WebResponseContent GenerateInboundTask(string stationCode, int inboundType, string palletCode) |
| | | { |
| | | return Service.GenerateInboundTask(stationCode, inboundType, palletCode); |
| | | } |
| | | |
| | | [HttpPost, Route("TaskCompleted"), AllowAnonymous] |
| | | [HttpPost, Route("TaskCompleted")] |
| | | public WebResponseContent TaskCompleted(int taskNum) |
| | | { |
| | | return Service.TaskCompleted(taskNum); |
| | | } |
| | | |
| | | [HttpPost, Route("GenerateOutboundTask"), AllowAnonymous] |
| | | [HttpPost, Route("GenerateOutboundTask")] |
| | | public WebResponseContent GenerateOutboundTask(int id, List<StockSelectViewDTO> stockSelectViews) |
| | | { |
| | | return Service.GenerateOutboundTask(id, stockSelectViews); |
| | | } |
| | | |
| | | [HttpPost, Route("GenerateOutboundTasks")] |
| | | public WebResponseContent GenerateOutboundTasks([FromBody] int[] keys) |
| | | { |
| | | return Service.GenerateOutboundTask(keys); |
| | | } |
| | | } |
| | | } |
| | |
| | | builder.Services.AddAllOptionRegister();//读åé
ç½®æä»¶ |
| | | builder.Services.AddMemoryCacheSetup();//ç¼å |
| | | builder.Services.AddSqlsugarSetup();//SqlSugar å¯å¨æå¡ |
| | | //builder.Services.AddInitializationHostServiceSetup();//åºç¨åå§åæå¡æ³¨å
¥ |
| | | builder.Services.AddInitializationHostServiceSetup();//åºç¨åå§åæå¡æ³¨å
¥ |
| | | builder.Services.AddDbSetup();//Db å¯å¨æå¡ |
| | | |
| | | builder.Services.AddAutoMapperSetup(); |