| | |
| | | using System.Threading.Tasks; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置当前条码的工序信息 |
| | | /// </summary> |
| | | public ApiAction<ScanOutput> SetOutPutMqttMsg(ApiAction<ScanOutput> action, string locale = null) |
| | | { |
| | | MQTT.Message msg = new() |
| | | { |
| | | IsSuccessed = action.IsSuccessed, |
| | | Content = Biz.T(action.LocaleMsg, locale), |
| | | }; |
| | | switch (action.Status) |
| | | { |
| | | case ApiAction.StatusCodes.Success: |
| | | msg.Voice = MQTT.Voice.Success; |
| | | msg.Color = "#FF1E90FF"; |
| | | break; |
| | | case ApiAction.StatusCodes.Warning: |
| | | msg.Voice = MQTT.Voice.Warning; |
| | | msg.Color = "#FFB8860B"; |
| | | break; |
| | | case ApiAction.StatusCodes.Error: |
| | | case ApiAction.StatusCodes.Failed: |
| | | msg.Voice = MQTT.Voice.Fail; |
| | | msg.Color = "#FFFF0000"; |
| | | break; |
| | | case ApiAction.StatusCodes.Exception: |
| | | msg.Voice = MQTT.Voice.Fail; |
| | | msg.Color = "#FF8B0000"; |
| | | break; |
| | | case ApiAction.StatusCodes.Normal: |
| | | case ApiAction.StatusCodes.NeedConfrim: |
| | | case ApiAction.StatusCodes.Confrimed: |
| | | default: |
| | | msg.Voice = MQTT.Voice.Silent; |
| | | msg.Color = "#FF000000"; |
| | | break; |
| | | } |
| | | if (action.IsSuccessed) |
| | | { |
| | | msg.Voice = MQTT.Voice.Pass; |
| | | msg.Color = "#FF228B22"; |
| | | } |
| | | else if (!action.IsSuccessed) |
| | | { |
| | | msg.Voice = MQTT.Voice.Fail; |
| | | msg.Color = "#FFFF0000"; |
| | | } |
| | | else |
| | | { |
| | | msg.Voice = MQTT.Voice.Silent; |
| | | msg.Color = "#FF000000"; |
| | | } |
| | | action.Data.MqttMsg = msg; |
| | | return action; |
| | | } |
| | | #endregion Functions |
| | | |
| | | public override bool Close(bool needSaveHistoryLog = false) |
| | |
| | | using Tiger.Business.WMS.Sharetronic.Shelf; |
| | | //using Microsoft.IdentityModel.Tokens; |
| | | using Tiger.Model.MES.Yada; |
| | | using static IronPython.Modules.PythonThread; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var inv = result.Data as Inventory; |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("状态[{0}]异常,请重新扫描"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(q => q.GetDesc()))); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | //物料验证 |
| | | if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N") |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("物料编码[{0}]不存在或者该物料未启用"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo?.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode)); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | if (inv.Items.Count == 0) |
| | |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("请确认条码[{0}]的数量是否正确"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ComfirmQty", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | } |
| | | |
| | |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("数量不能小于等于零,请重新确认条码[{0}]的数量"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ReComfirmQty", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L(shelfApiResult.GetData<string>()); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var reaultShelf = shelfApiResult.GetData<ShelfChangeModel>(); |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"货架[{0}]中不存在id为[{1}]的储位,请先维护货架信息"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationNotExistsInShelf", CurScanShelf.Shelf.SHELF_CODE, reaultShelf.ledAddr); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var locationData = MainDB.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.ID).First(); |
| | | if (!locationData.IsNullOrEmpty()) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("储位[{0}]已存有物料[{1}],请检查系统库存信息"); |
| | | action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", nLocation.LOCATION_CODE, locationData.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | CurScanShelf.LocationCode = nLocation.LOCATION_CODE; |
| | | } |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("请输入或扫描有效的货架/储位码"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | nLocation = await MainDB.Queryable<WMS_LOCATION>().Where(t => t.LOCATION_CODE == CurScanShelf.LocationCode && t.AUTH_ORG == OrgCode).FirstAsync(); |
| | |
| | | //action.LocaleMsg = Biz.L("储位[{0}]只能存放一个物料"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE); |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | //执行上架数据处理 |
| | |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = putonResult.LocaleMsg; |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | //完成所有处理后使用事务保存数据 |
| | |
| | | //action.CatchExceptionWithLog(ex, $"扫描条码[{input.SN}]复核异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | //重置扫码信息 |
| | | ResetScanInfo(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, locale); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L("WMS.InSemiProd.ScanItem.WoEmptyFailure", input.SN); // $"工单[{input.SN}]不存在" |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | var semiTemplateQty = (input.Data ?? "").JsonToObject<SemiTemplateQty>() ?? new SemiTemplateQty(); |
| | |
| | | using System.Threading.Tasks; |
| | | using Tiger.Model; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var inv = result.Data as Inventory; |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"状态[{0}]异常,请重新扫描"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(x => x.GetDesc()))); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | //储位验证 |
| | | if (inv.Location.IsNullOrEmpty()) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"条码[{0}]库存信息异常: 没有储位信息,请先上架后再扫描(储位Id: {1})"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationIsNull", inv.CurPkg.SN, inv.CurPkg.LOCATION_ID); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | //物料验证 |
| | | if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N") |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"物料编码[{0}]不存在或者该物料未启用"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode)); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | CurInvItem = inv; |
| | | |
| | |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("请确认条码[{0}]要下架的数量"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ComfirmOutQty", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | } |
| | | |
| | |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("下架数量不能小于等于零,请重新确认条码[{0}]的下架数量"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ReComfirmOutQty", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | else if (qtyList.Any(q => q.QTY > CurInvItem.Items.First(i => i.SN == q.SN).QTY)) |
| | | { |
| | |
| | | action.Data.Command = Command = "ComfirmQty"; |
| | | //action.LocaleMsg = Biz.L("下架数量不能超过原条码数量,请重新确认条码[{0}]的下架数量"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ReComfirmExceedOutQty", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | else |
| | | { |
| | |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = downResult.LocaleMsg; |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | //灭灯 |
| | |
| | | //action.CatchExceptionWithLog(ex, $"扫描条码[{input.SN}]复核异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | //重置工序 |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, locale); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("条码为非法条码"); |
| | | action.LocaleMsg = Biz.L("WMS.WmsItem.Barcode.IllegalFailure", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | |
| | | if (barcode.Type == Barcode.Types.OuterPackage) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("ASN单中不存在条码[{0}]"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.SnNotExists", input.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | if (CurSn.First().AUTH_ORG != input.AuthOption.CurOrg) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"条码所属组织[{0}]与当前登录组织[{1}]不一致,请重新选择组织"); |
| | | action.LocaleMsg = Biz.L("WMS.Count_BIZ_U9_ASN.OrgNotCorrect", CurSn.First().AUTH_ORG, input.AuthOption.CurOrg); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | //验证条码是否正确 |
| | | if (CurSn.First().STATUS > WMS_ITEM.STATUSs.Incoming.GetValue()) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("状态[{0}]异常,请重新扫描"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", CurSn.First().STATUS.GetEnumDesc<WMS_ITEM.STATUSs>()); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); ; |
| | | } |
| | | |
| | | //执行清点数据处理 |
| | |
| | | //action.CatchExceptionWithLog(ex, $"扫描条码[{0}]复核异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | //重置工序 |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, locale); ; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | using Tiger.Model.Sharetronic.Shelf; |
| | | using Tiger.Business.WMS.Sharetronic.Shelf; |
| | | using Tiger.Model.Entitys.MES.U9C; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var inv = result.Data as Inventory; |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("状态[{0}]异常,请重新扫描"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.StatusException", string.Join(',', inv.StatusList.Select(q => q.GetDesc()))); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | //物料验证 |
| | | if (inv.ItemInfo.IsNullOrEmpty() || inv.ItemInfo.IS_ACTIVE == "N") |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("物料编码[{0}]不存在或者该物料未启用"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.ItemCodeNotExistsOrNotActive", inv.ItemInfo.ITEM_CODE.IsNullOrEmpty(inv.Barcode.ItemCode)); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | CurInvItem = inv; |
| | | } |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("收货单中找不到条码所属的单据[{0}]信息,请重新扫描收货单的条码或选择正确的功能上架"); |
| | | action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.ReceiptNotExists", CurInvItem.Items.First().TRANS_NO); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var receiptDtl = receipt.Details.First(q => q.LINE_NO == CurInvItem.Items.First().TRANS_LINE); |
| | | if (receiptDtl.STATUS > BIZ_U9_RECEIPT.STATUSs.Storing.GetValue()) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("收货单中行[{0}]状态[{1}]异常,请扫描正确的条码"); |
| | | action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.ReceiptDtlStatusException", receiptDtl.LINE_NO, receiptDtl.STATUS.GetEnumDesc<BIZ_U9_RECEIPT.STATUSs>()); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var receiptSn = receipt.SnList.Where(q => CurInvItem.Items.Any(i => i.SN == q.SN)).ToList(); |
| | | if (receiptSn.Any(q => q.STATUS != WMS_ITEM.STATUSs.WaitIn.GetValue())) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("收货单中条码[{0}]状态[{1}]异常,请扫描正确的条码"); |
| | | action.LocaleMsg = Biz.L("WMS.In_BIZ_U9_RECEIPT.ScanItem.ReceiptSnStatusException", CurInvItem.SN, receiptSn.First(q => q.STATUS != WMS_ITEM.STATUSs.WaitIn.GetValue()).STATUS.GetEnumDesc<WMS_ITEM.STATUSs>()); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | var nLocation = new WMS_LOCATION(); |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L(shelfApiResult.GetData<string>()); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var reaultShelf = shelfApiResult.GetData<ShelfChangeModel>(); |
| | | |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L($"货架[{0}]中不存在id为[{1}]的储位,请先维护货架信息"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationNotExistsInShelf", CurScanShelf.Shelf.SHELF_CODE, reaultShelf.ledAddr); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var locationData = MainDB.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == nLocation.ID).First(); |
| | | if (!locationData.IsNullOrEmpty()) |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("储位[{0}]已存有物料[{1}],请检查系统库存信息"); |
| | | action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", nLocation.LOCATION_CODE, locationData.SN); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | CurScanShelf.LocationCode = nLocation.LOCATION_CODE; |
| | | } |
| | |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("请输入或扫描有效的货架/储位码"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | nLocation = await MainDB.Queryable<WMS_LOCATION>().Where(t => t.LOCATION_CODE == CurScanShelf.LocationCode && t.AUTH_ORG == OrgCode).FirstAsync(); |
| | |
| | | //action.LocaleMsg = Biz.L("储位[{0}]只能存放一个物料"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanItem.LocationSingleFailure", nLocation.LOCATION_CODE); |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | //执行上架数据处理 |
| | |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = putonResult.LocaleMsg; |
| | | ResetScan(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | //更新单据信息 |
| | |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = result.LocaleMsg; |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | } |
| | | else |
| | |
| | | //action.CatchExceptionWithLog(ex, $"扫描条码[{input.SN}]复核异常"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.ScanItem.ScanException", input.SN)); |
| | | } |
| | | return action; |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | //重置工序 |
| | | ResetScanInfo(); |
| | | return action; |
| | | return SetOutPutMqttMsg(action, locale); |
| | | } |
| | | |
| | | #endregion |