| | |
| | | |
| | | //如果返回成功则认为当前行为可以开始执行,否则返回失败 |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("等待上料", ShortMessage.Types.Normal); |
| | | return action; |
| | | } |
| | | |
| | |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | WIP_ID = wipSn.ID, |
| | | SN = input.SN, |
| | | PROD_SN = wipSn.SN, |
| | | ITEM_CODE = item.ItemInfo.ITEM_CODE, |
| | |
| | | } |
| | | else |
| | | { |
| | | var record = new MES_WIP_ASSY() |
| | | foreach (var wipSn in CurPosition.CurWipSNs) |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | SN = input.SN, |
| | | PROD_SN = CurPosition.CurSN, |
| | | ITEM_CODE = item.ItemInfo.ITEM_CODE, |
| | | QTY = 1, |
| | | UNIT = item.ItemInfo.UNIT, |
| | | WORK_ORDER = CurPosition.CurWipSNs.First().WORK_ORDER, |
| | | BATCH_NO = CurPosition.CurWipSNs.First().BATCH_NO, |
| | | ROT_CODE = CurPosition.CurWipSNs.First().ROT_CODE, |
| | | NODE_ID = CurPosition.CurWipSNs.First().NODE_ID, |
| | | NODE_NAME = CurPosition.CurWipSNs.First().NODE_NAME, |
| | | FTY_CODE = CurPosition.CurWipSNs.First().FTY_CODE, |
| | | WS_CODE = CurPosition.CurWipSNs.First().WS_CODE, |
| | | LINE_CODE = CurPosition.CurWipSNs.First().LINE_CODE, |
| | | POST_CODE = CurPosition.CurWipSNs.First().POST_CODE, |
| | | OPER_CODE = CurPosition.CurWipSNs.First().OPER_CODE, |
| | | SEGMENT = CurPosition.CurWipSNs.First().SEGMENT, |
| | | }; |
| | | item.Records.Add(record); |
| | | var record = new MES_WIP_ASSY() |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | WIP_ID = wipSn.ID, |
| | | SN = input.SN, |
| | | PROD_SN = wipSn.SN, |
| | | ITEM_CODE = item.ItemInfo.ITEM_CODE, |
| | | QTY = 1, |
| | | UNIT = item.ItemInfo.UNIT, |
| | | WORK_ORDER = wipSn.WORK_ORDER, |
| | | BATCH_NO = wipSn.BATCH_NO, |
| | | ROT_CODE = wipSn.ROT_CODE, |
| | | NODE_ID = wipSn.NODE_ID, |
| | | NODE_NAME = wipSn.NODE_NAME, |
| | | FTY_CODE = wipSn.FTY_CODE, |
| | | WS_CODE = wipSn.WS_CODE, |
| | | LINE_CODE = wipSn.LINE_CODE, |
| | | POST_CODE = wipSn.POST_CODE, |
| | | OPER_CODE = wipSn.OPER_CODE, |
| | | SEGMENT = wipSn.SEGMENT, |
| | | }; |
| | | item.Records.Add(record); |
| | | } |
| | | |
| | | if (item.Records.Sum(q => q.QTY) >= item.LoadQty * CurPosition.CurWipSNs.Count) |
| | | if (item.Records.Sum(q => q.QTY) / item.Records.Count >= item.LoadQty * CurPosition.CurWipSNs.Count) |
| | | { |
| | | item.IsFinished = true; |
| | | } |
| | | } |
| | | |
| | | action.IsSuccessed = true; |
| | | action.Data.Data = CurAssembly; |
| | | action.Data.ShortMsg = new("上料成功", ShortMessage.Types.Success); |
| | | action.Data.Data = CurAssembly; |
| | | //action.LocaleMsg = new Locale($"扫描物料[{item.ItemInfo.ITEM_NAME}({item.ItemInfo.ITEM_CODE})的条码[{input.SN}]成功,请继续上料"); |
| | | action.LocaleMsg = new Locale("MES.WorkAction.Assembly.LoadSuccess", item.ItemInfo.ITEM_NAME, item.ItemInfo.ITEM_CODE); |
| | | |
| | |
| | | } |
| | | //都没有物料验证通过,则返回错误信息 |
| | | action.IsSuccessed = false; |
| | | action.Data.ShortMsg = new("上料失败", ShortMessage.Types.Failed); |
| | | //action.LocaleMsg = new($"条码[{input.SN}]验证失败,不是以下物料的条码:{string.Join(",", CurAssembly.Items.Where(q => !q.IsFinished).Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); |
| | | action.LocaleMsg = new("MES.WorkAction.Assembly.LoadFail", input.SN, string.Join(",", CurAssembly.Items.Where(q => !q.IsFinished).Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); |
| | | } |
| | | catch (System.Exception ex) |
| | | { |
| | | action.Data.ShortMsg = new("上料异常", ShortMessage.Types.Exception); |
| | | action.CatchExceptionWithLog(ex, $"上料行为:验证条码[{input.SN}]并保存数据异常"); |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"验证条码[{input.SN}]并保存数据异常,工序已重置,请重新扫描进站产品条码"); |
| | |
| | | { |
| | | AUTH_ORG = CurPosition.WorkBatch.WO.AUTH_ORG, |
| | | AUTH_PROD = CurPosition.CurLine.LINE_CODE, |
| | | WIP_ID = wipSn.ID, |
| | | HIS_ID = CurPosition.CurWipSNHiss.First(q => q.SN == wipSn.SN).ID, |
| | | SN = wipSn.SN, |
| | | STATUS = wipSn.STATUS, |
| | |
| | | POST_CODE = wipSn.POST_CODE, |
| | | OPER_CODE = wipSn.OPER_CODE, |
| | | SEGMENT = wipSn.SEGMENT, |
| | | FLOW_SN = wipSn.FLOW_SN, |
| | | TRAY_SN = wipSn.TRAY_SN, |
| | | INNER_SN = wipSn.INNER_SN, |
| | | CARTON_SN = wipSn.CARTON_SN, |
| | | PALLET_SN = wipSn.PALLET_SN, |
| | | OPERATION_TIME = DateTime.Now, |
| | | SFTS_CODE = wipSn.SFTS_CODE, |
| | | SFT_CODE = wipSn.SFT_CODE, |
| | |
| | | }; |
| | | |
| | | IsFinished = true; |
| | | action.Data.ShortMsg = new("上料完成", ShortMessage.Types.Success); |
| | | //action.LocaleMsg = new($"以下物料上料完成:{string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))}"); |
| | | action.LocaleMsg = new("MES.WorkAction.Assembly.LoadFinish", string.Join(",", CurAssembly.Items.Select(q => $"{q.ItemInfo.ITEM_NAME}({q.ItemInfo.ITEM_CODE})"))); |
| | | return action; |