| | |
| | | using Microsoft.AspNetCore.Http; |
| | | using Tiger.Model.Entitys.MES.BizMesWoBatch; |
| | | using Tiger.Model.Entitys.MES.BizMesWo; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | | namespace Tiger.Business.MES |
| | | { |
| | |
| | | result.LocaleMsg = new($"工单下发的数量超过工单计划数量,不能下发!"); |
| | | return result; |
| | | } |
| | | if (!Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Any(x => x.ORDER_NO == input.Wo.ORDER_NO && x.ACT_LINE == input.WoBatch.ACT_LINE && x.STATUS==(int)BIZ_MES_WO_BATCH.STATUSs.Closed)) |
| | | if (Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Any(x => x.ORDER_NO == input.Wo.ORDER_NO && x.ACT_LINE == input.WoBatch.ACT_LINE && x.STATUS> BIZ_MES_WO.STATUSs.Imported.GetValue() && x.STATUS< BIZ_MES_WO.STATUSs.Closed.GetValue())) |
| | | { |
| | | result.IsSuccessed = false; |
| | | result.LocaleMsg = new($"工单在线体[{input.WoBatch.ACT_LINE}]有没完工的工单批次,不能下发!"); |
| | | result.LocaleMsg = new($"工单批次在线体[{input.WoBatch.ACT_LINE}]中状态为[{input.WoBatch.STATUS.GetEnumDesc<BIZ_MES_WO.STATUSs>()}],不能下发!"); |
| | | return result; |
| | | } |
| | | WoContext.RemoveBatch(input.WoBatch.BATCH_NO); |
| | |
| | | var db = Biz.Db; |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | | db.Updateable(_wo, input.UserId).ExecuteCommand(); |
| | | db.Updateable(_wo, input.UserId).UpdateColumns(x => new { x.STATUS }).ExecuteCommand(); |
| | | }); |
| | | if (!dbTran.IsSuccess) |
| | | { |
| | |
| | | var result = new ApiAction(); |
| | | try |
| | | { |
| | | //保存前的判断,并生成批次号 |
| | | var _wo = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Where(x => x.BATCH_NO == input.WoBatch).FirstAsync(); |
| | | if (_wo != null) |
| | | //保存前的判断 |
| | | var _woBatch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().Where(x => x.BATCH_NO == input.WoBatch).FirstAsync(); |
| | | if (_woBatch != null) |
| | | { |
| | | _wo.STATUS = input.Status < 0 ? _wo.STATUS : input.Status; |
| | | if (input.Status == (int) BIZ_MES_WO_BATCH.STATUSs.Paused) { |
| | | _woBatch.STATUS = input.Status < 0 ? _woBatch.STATUS : input.Status; |
| | | if (input.Status == BIZ_MES_WO_BATCH.STATUSs.Paused.GetValue()) { |
| | | WoContext.RemoveBatch(input.WoBatch); |
| | | } |
| | | } |
| | |
| | | var db = Biz.Db; |
| | | var dbTran = db.UseTran(() => |
| | | { |
| | | db.Updateable(_wo, input.UserId).ExecuteCommand(); |
| | | db.Updateable(_woBatch, input.UserId).UpdateColumns(x=> new { x.STATUS}).ExecuteCommand(); |
| | | }); |
| | | if (!dbTran.IsSuccess) |
| | | { |