| | |
| | | using System.Globalization; |
| | | using Tiger.Business.MES.WorkAction; |
| | | using System.Collections; |
| | | using Tiger.IBusiness.MES.WorkAction; |
| | | using Dm.parser; |
| | | |
| | | namespace Tiger.Business.MES.Transaction |
| | | { |
| | |
| | | public WorkBatch CurBatch { get; set; } |
| | | public IWorkBatch WorkBatch => CurBatch; |
| | | public List<MES_WIP_DATA> CurWipSNs { get; set; } = new(); |
| | | public List<MES_WIP_DATA> LastWipSNs { get; set; } = new(); |
| | | public string CurSN => (CurWipSNs.Any() ? (CurWipSNs.First().TRAY_SN.IsNullOrEmpty() ? CurWipSNs.First().SN : CurWipSNs.First().TRAY_SN) : ""); |
| | | public List<MES_WIP_HIS> CurWipSNHiss { get; set; } = new(); |
| | | public List<MES_WIP_DFT> CurDefects { get; set; } = new(); |
| | |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction> SelectOrder(WoInput input) |
| | | public async Task<ApiAction> SelectOrder(WoInput input, string batchNo = "") |
| | | { |
| | | var action = new ApiAction(); |
| | | try |
| | | { |
| | | if (!WoContext.ExistsBatch(input.OrderNo, CurLine.LINE_CODE)) |
| | | if (!WoContext.ExistsBatch(input.OrderNo, CurLine.LINE_CODE, batchNo, true)) |
| | | { |
| | | var wo = await Biz.Db.Queryable<BIZ_MES_WO>().ByAuth(input.AuthOption).Where(q => q.ORDER_NO == input.OrderNo).FirstAsync(); |
| | | //验证明细是否正确 |
| | |
| | | if (wo.STATUS != BIZ_MES_WO.STATUSs.Release.GetValue() && wo.STATUS != BIZ_MES_WO.STATUSs.Working.GetValue()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"工单[{input.OrderNo}]状态[{wo.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName()}]不能生产"); |
| | | action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, wo.STATUS.GetEnum<BIZ_MES_WO.STATUSs>().GetName()); |
| | | //action.LocaleMsg = new($"工单[{0}]状态[{1}]不能生产"); |
| | | action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, wo.STATUS.GetEnumDesc<BIZ_MES_WO.STATUSs>()); |
| | | return action; |
| | | } |
| | | var batch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().ByAuth(input.AuthOption).Where(q => q.ORDER_NO == input.OrderNo && q.ACT_LINE == CurLine.LINE_CODE).FirstAsync(); |
| | | var batch = await Biz.Db.Queryable<BIZ_MES_WO_BATCH>().ByAuth(input.AuthOption) |
| | | .Where(q => q.ORDER_NO == input.OrderNo && q.ACT_LINE == CurLine.LINE_CODE) |
| | | .WhereIF(!batchNo.IsNullOrEmpty(), q => q.BATCH_NO == batchNo) |
| | | .OrderBy(q => q.STATUS).FirstAsync(); |
| | | if (batch.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | |
| | | if (batch.STATUS != BIZ_MES_WO_BATCH.STATUSs.Release.GetValue() && batch.STATUS != BIZ_MES_WO_BATCH.STATUSs.Working.GetValue()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = new($"工单[{input.OrderNo}]状态[{wo.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()}]不能生产"); |
| | | action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.StatusException", input.OrderNo, batch.STATUS.GetEnum<BIZ_MES_WO_BATCH.STATUSs>().GetName()); |
| | | //action.LocaleMsg = new($"工单[{0}]批次[1]状态[{2}]不能生产"); |
| | | action.LocaleMsg = new("MES.Transaction.Position.SelectOrder.BatchStatusException", input.OrderNo, batch.BATCH_NO, batch.STATUS.GetEnumDesc<BIZ_MES_WO_BATCH.STATUSs>()); |
| | | return action; |
| | | } |
| | | var wb = new WorkBatch(input.OrderNo).Init(CurLine.LINE_CODE); |
| | | WoContext.WoBatchDic.Add(wb.Batch.BATCH_NO, wb); |
| | | batchNo = wb.Batch.BATCH_NO; |
| | | } |
| | | CurBatch = WoContext.GetBatch(input.OrderNo, CurLine.LINE_CODE); |
| | | CurBatch = WoContext.GetBatch(input.OrderNo, CurLine.LINE_CODE, batchNo); |
| | | if (!OperInfoDic.ContainsKey(CurBatch.Batch.BATCH_NO)) |
| | | { |
| | | OperInfoDic.Add(CurBatch.Batch.BATCH_NO, new()); |
| | |
| | | if (CurWipSNs.Any()) |
| | | { |
| | | info.CurNode = CurWipSNs.First().NODE_NAME; |
| | | info.NextNode = string.Join(",", CurBatch.GetNextNodes(CurWipSNs.First()).Select(q => q.NODE_NAME)); |
| | | var nextNodes = CurBatch.GetNextNodes(CurWipSNs.First()); |
| | | info.NextNode = string.Join(",", nextNodes.Select(q => q.NODE_NAME)); |
| | | if (nextNodes.Count == 1 && nextNodes.Single().OPER_CODE == "EndNode") |
| | | { |
| | | info.IsReachedEndNode = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | //保存工步的数据库提交操作到提交操作列表 |
| | | if (!Steps.IsNullOrEmpty()) |
| | | { |
| | | var commitList = new List<Action>(); |
| | | foreach (var step in Steps.OrderBy(q => q.Sequence)) |
| | | { |
| | | commitList.Add(step.DBSubmitAction); |
| | | } |
| | | //记录工序耗时 |
| | | commitList.Add(() => |
| | | { |
| | | EndAt = DateTime.Now; |
| | | var ids = CurWipSNHiss.Select(q => q.ID).ToList(); |
| | | GetCommitDB().Updateable<MES_WIP_HIS>().SetColumns(q => q.ELAPSED_TIME == ElapsedTime.TotalMilliseconds.ToInt64()).Where(q => ids.Contains(q.ID)).ExecuteCommand(); |
| | | }); |
| | | var commitList = new List<Action>(); |
| | | foreach (var step in Steps.OrderBy(q => q.Sequence)) |
| | | { |
| | | commitList.Add(step.DBSubmitAction); |
| | | } |
| | | //记录工序耗时 |
| | | var ids = CurWipSNHiss.Select(q => q.ID).ToList().Clone(); |
| | | commitList.Add(() => |
| | | { |
| | | EndAt = DateTime.Now; |
| | | GetCommitDB().Updateable<MES_WIP_HIS>().SetColumns(q => q.ELAPSED_TIME == ElapsedTime.TotalMilliseconds.ToInt64()).Where(q => ids.Contains(q.ID)).ExecuteCommand(); |
| | | }); |
| | | //增加附加的保存内容 |
| | | if (!appendToSave.IsNullOrEmpty()) |
| | | { |
| | | commitList.Add(appendToSave); |
| | | } |
| | | DBCommitList.Add(CurSN, commitList); |
| | | DBCommitList.Add(CurSN, commitList); |
| | | } |
| | | else |
| | | { |
| | |
| | | throw dbTran.ErrorException; |
| | | } |
| | | } |
| | | //记录最后成功过站的条码 |
| | | LastWipSNs.Clear(); |
| | | LastWipSNs.AddRange(CurWipSNs); |
| | | } |
| | | |
| | | protected void DoSaveToDB() |
| | |
| | | /// <returns></returns> |
| | | public BAS_LABEL_TEMP SetLabelVariables(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_TEMP label, IWorkAction action) |
| | | { |
| | | return SetLabelVariables(labelPVs, label, action, null); |
| | | } |
| | | |
| | | public BAS_LABEL_TEMP SetLabelVariables(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_TEMP label, IWorkAction action, WipPkg? CurPkg) |
| | | { |
| | | foreach (var item in label.Variables.OrderBy(q => q.VAR_TYPE == BAS_LABEL_VAR.VAR_TYPEs.BarcodeGenerate.GetValue() ? 0 : 1)) |
| | | { |
| | | switch (item.VAR_TYPE.GetEnum<BAS_LABEL_VAR.VAR_TYPEs>()) |
| | |
| | | item.Value = item.VAR_VALUE; |
| | | break; |
| | | case BAS_LABEL_VAR.VAR_TYPEs.ProcessVariable: |
| | | item.Value = GetPrintProcessValue(labelPVs, item, label.Variables, action); |
| | | item.Value = GetPrintProcessValue(labelPVs, item, label.Variables, action, CurPkg); |
| | | break; |
| | | case BAS_LABEL_VAR.VAR_TYPEs.DateVariable: |
| | | item.Value = DateTime.Now.ToString(item.VAR_VALUE); |
| | |
| | | /// <param name="labelPVs">过程变量列表</param> |
| | | /// <param name="lv">标签模板变量</param> |
| | | /// <returns></returns> |
| | | public string GetPrintProcessValue(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_VAR lv, List<BAS_LABEL_VAR> lvars, IWorkAction action) |
| | | public string GetPrintProcessValue(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_VAR lv, List<BAS_LABEL_VAR> lvars, IWorkAction curAction, WipPkg? CurPkg) |
| | | { |
| | | var pv = labelPVs.FirstOrDefault(q => q.VAR_CODE == lv.VAR_VALUE); |
| | | if (!pv.IsNullOrEmpty()) |
| | |
| | | { |
| | | case "GetSN": |
| | | return CurSN; |
| | | case "GetItemCode": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ITEM_CODE); |
| | | case "GetBAS_ITEM": |
| | | return WorkBatch.Product.CUST_PROD_CODE; |
| | | return GetLabelVarWo(lv, WorkBatch.Product.CUST_PROD_CODE); |
| | | case "GetItemName": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ITEM_NAME); |
| | | case "GetCustomer": |
| | | return WorkBatch.Batch.Customer.ToJson(); |
| | | return GetLabelVarWo(lv, WorkBatch.Batch.Customer.ToJson()); |
| | | case "GetSalesOrder": |
| | | return GetLabelVarWo(lv, WorkBatch.WO.SALES_ORDER); |
| | | case "GetPackNumber": |
| | | return GetLabelVarWo(lv, WorkBatch.WO.ORDER_NO); |
| | | case "GetBoxQR": |
| | | return action is PackingAction ? GetBoxCode(lvars, action as PackingAction) : ""; |
| | | return GetCardOrBoxQR(GetBoxCode(), curAction, CurPkg); |
| | | case "GetCardQR": |
| | | return action is PackingAction ? GetCardCode(lvars, action as PackingAction) : ""; |
| | | return GetCardOrBoxQR("", curAction, CurPkg); |
| | | case "GetCardSN": |
| | | List<string> minPkgList = new List<string>(); |
| | | var _pkaction = action is PackingAction ? action as PackingAction : null; |
| | | if (_pkaction != null) |
| | | if (!CurPkg.IsNullOrEmpty()) |
| | | { |
| | | minPkgList = GetMinPkgList(_pkaction); |
| | | minPkgList = CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | else |
| | | { |
| | | var _pkaction = curAction is PackingAction ? curAction as PackingAction : null; |
| | | if (!_pkaction.IsNullOrEmpty()) |
| | | { |
| | | minPkgList = GetMinPkgList(_pkaction); |
| | | } |
| | | } |
| | | return string.Join("\r\n", minPkgList); |
| | | case "GetDescription": |
| | | return WorkBatch.Product.ITEM_DESC; |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ITEM_DESC); |
| | | case "GetFengZ": |
| | | return WorkBatch.Product.ExtInfo.Packaging; |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.Packaging); |
| | | case "GetPAndO": |
| | | return WorkBatch.WO.SALES_CONTRACT; |
| | | return GetLabelVarWo(lv, WorkBatch.WO.SALES_CONTRACT); |
| | | case "GetLTD": |
| | | return WorkBatch.Batch.Customer.SHORT_NAME; |
| | | return GetLabelVarWo(lv, WorkBatch.WO.Customer?.CUST_NAME_CN); |
| | | case "GetHWDate": |
| | | List<string> list = new List<string>(); |
| | | var _action = action is PackingAction ? action as PackingAction : null; |
| | | if (_action!=null) |
| | | if (!CurPkg.IsNullOrEmpty()) |
| | | { |
| | | list = GetMinPkgList(_action); |
| | | list = CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | else |
| | | { |
| | | var _action = curAction is PackingAction ? curAction as PackingAction : null; |
| | | if (_action != null) |
| | | { |
| | | list = _action.CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | } |
| | | return GetHuaWeiWeek(WorkBatch.Batch.ORDER_NO, list); |
| | | case "GetQty": |
| | | List<string> qtylist = new List<string>(); |
| | | var _qtyAction = action is PackingAction ? action as PackingAction : null; |
| | | if (_qtyAction != null) |
| | | if (!CurPkg.IsNullOrEmpty()) |
| | | { |
| | | qtylist = GetMinPkgList(_qtyAction); |
| | | qtylist = CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | return $"{qtylist.Count}PCS"; |
| | | else |
| | | { |
| | | if (curAction is PackingAction) |
| | | { |
| | | qtylist = (curAction as PackingAction).CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | if (curAction is PrintInStoreLabel) |
| | | { |
| | | qtylist = (curAction as PrintInStoreLabel).CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | } |
| | | return $"{qtylist.Count}"; |
| | | case "GetModel": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.Model); |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Model); |
| | | case "GetInput": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.Input); |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Input); |
| | | case "GetOutput": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.OutPut); |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.OutPut); |
| | | case "GetPower": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.Power); |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Power); |
| | | case "GetAccuracy": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.Accuracy); |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Accuracy); |
| | | case "GetVarByWo": |
| | | return GetLabelVarWo(lv, ""); |
| | | case "GetLOTNO": |
| | | string _lotnos = ""; |
| | | var _orderAction = curAction is PackingAction ? curAction as PackingAction : null; |
| | | if (!CurPkg.IsNullOrEmpty()) |
| | | { |
| | | qtylist = CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | } |
| | | else |
| | | { |
| | | if (_orderAction != null) |
| | | { |
| | | var snList = _orderAction.CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | if (!snList.Any()) |
| | | { |
| | | snList.Add(_orderAction.CurPkg.CustSN?.FLOW_SN); |
| | | } |
| | | _lotnos = string.Join(",", Biz.Db.Queryable<MES_CUST_SN>() |
| | | .Where((q) => snList.Contains(q.FLOW_SN)) |
| | | .Select((q) => q.WORK_ORDER).Distinct().ToList()); |
| | | return _lotnos; |
| | | } |
| | | } |
| | | return ""; |
| | | case "GetNOTES": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Remark); |
| | | case "GetXH": |
| | | return ""; |
| | | case "GetCardNo": |
| | | return $"{Context["CurWaitShipmentCarton"].ToInt32() + 1}"; |
| | | case "GetCardTotal": |
| | | var total = ""; |
| | | var _curaction = curAction is PackingAction ? curAction as PackingAction : null; |
| | | if (!_curaction.IsNullOrEmpty()) { |
| | | total = $"{Math.Ceiling(Context["CurShipQty"].ToDecimal()/_curaction.PkgRule.GetTotalQty().ToDecimal())}"; |
| | | } |
| | | return total; |
| | | case "GetModelSpec": //Model+空格+SPEC, |
| | | return GetLabelVarWo(lv, $"{WorkBatch.Product.ExtInfo?.Model} {WorkBatch.Product.SPEC}"); |
| | | case "GetDATE": |
| | | return GetLabelVarWo(lv, $"{DateTime.Now.ToString("yyyy/MM/dd")}"); |
| | | default: |
| | | return ""; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | result = value.IsNullOrEmpty() ? (labelVarwos.Count > 0 ? labelVarwos.First().DEFAULT_VALUE : "") : value; |
| | | result = value.IsNullOrEmpty() ? (labelVarwos.Count > 0 ? labelVarwos.First(q => q.WORK_ORDER.IsNullOrEmpty()).DEFAULT_VALUE : "") : value; |
| | | } |
| | | return result; |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private List<string> GetMinPkgList(PackingAction action) { |
| | | private List<string> GetMinPkgList(PackingAction action) |
| | | { |
| | | List<string> list = new List<string>(); |
| | | if (action.CurPkg.Item.PKG_LEVEL == 1) |
| | | if (action.CurPkg.IsNullOrEmpty()) |
| | | { |
| | | list.Add(CurSN); |
| | | } |
| | | else |
| | | { |
| | | list = action.GetMinPackageList(action.CurPkg.Item).Select(q => q.SN).ToList(); |
| | | list = action.CurPkg.Item.GetMinPackageList().Select(q => q.SN).ToList(); |
| | | } |
| | | return list; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 获取白盒条码 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private string GetBoxCode(List<BAS_LABEL_VAR> lvars, PackingAction action) |
| | | private string GetBoxCode() |
| | | { |
| | | var boxCode = Biz.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | return GetCardOrBoxQR(boxCode, lvars, action); |
| | | return Biz.CodeRule["WhiteBoxNo"]?.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取箱条码 |
| | | /// </summary> |
| | | /// <param name="lvars"></param> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private string GetCardCode(List<BAS_LABEL_VAR> lvars, PackingAction action) |
| | | private string GetCardCode() |
| | | { |
| | | var cardCode = Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? "" ; |
| | | return GetCardOrBoxQR(cardCode, lvars, action); |
| | | return Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="lvars"></param> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private string GetCardOrBoxQR(string code, List<BAS_LABEL_VAR> lvars, PackingAction action) |
| | | private string GetCardOrBoxQR(string code, IWorkAction action, WipPkg? CurPkg) |
| | | { |
| | | var minPkgList = action.GetMinPackageList(action.CurPkg.Item).Select(q => q.SN); |
| | | List<string> minPkgList = new List<string>(); |
| | | var itemCode = ""; |
| | | double weight = 0; |
| | | var unit = ""; |
| | | if (!CurPkg.IsNullOrEmpty()) |
| | | { |
| | | minPkgList = CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | itemCode = CurPkg.CustSN?.ITEM_CODE; |
| | | weight = CurPkg.WeightInfo.Weight; |
| | | unit = CurPkg.WeightInfo.Unit?.ToUpper() ?? "kg"; |
| | | } |
| | | else |
| | | { |
| | | if (action is PackingAction) |
| | | { |
| | | var pkg = action as PackingAction; |
| | | //minPkgList = pkg.CurPkg.Item.GetMinPackageList().Select(q => q.SN).ToList(); |
| | | minPkgList = pkg.CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | itemCode = pkg.CurPkg.CustSN?.ITEM_CODE; |
| | | weight = pkg.CurPkg.WeightInfo.Weight; |
| | | unit = pkg.CurPkg.WeightInfo.Unit?.ToUpper() ?? "kg"; |
| | | } |
| | | if (action is PrintInStoreLabel) |
| | | { |
| | | var print = action as PrintInStoreLabel; |
| | | //minPkgList = print.CurPkg.Item.GetMinPackageList().Select(q => q.SN).ToList(); |
| | | minPkgList = print.CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | itemCode = print.CurPkg.CustSN?.ITEM_CODE; |
| | | weight = print.CurPkg.WeightInfo.Weight; |
| | | unit = print.CurPkg.WeightInfo.Unit?.ToUpper() ?? "kg"; |
| | | } |
| | | } |
| | | var wo = WorkBatch.Batch.ORDER_NO; |
| | | var snList = string.Join("\r\n", minPkgList); |
| | | if (snList.IsNullOrEmpty()) { snList = $"{CurSN}"; } |
| | | var _sn = minPkgList.FirstOrDefault() ?? CurSN; |
| | | var itemCode = Biz.Db.Queryable<MES_CUST_SN>().Where(q => q.FLOW_SN == _sn || q.CUST_CODE == _sn).First()?.ITEM_CODE; |
| | | var weight = action.CurPkg.WeightInfo.Weight; |
| | | var unit = action.CurPkg.WeightInfo.Unit.ToUpper(); |
| | | var model = WorkBatch.Product.ExtInfo.Model; |
| | | var Input = WorkBatch.Product.ExtInfo.Input; |
| | | var OutPut = WorkBatch.Product.ExtInfo.OutPut; |
| | | var Power = WorkBatch.Product.ExtInfo.Power; |
| | | var Accuracy = WorkBatch.Product.ExtInfo.Accuracy; |
| | | var Display = WorkBatch.Product.ExtInfo.Display; |
| | | var Remark = WorkBatch.Product.ExtInfo.Remark; |
| | | var model = WorkBatch.Product.ExtInfo?.Model; |
| | | var Input = WorkBatch.Product.ExtInfo?.Input; |
| | | var OutPut = WorkBatch.Product.ExtInfo?.OutPut; |
| | | var Power = WorkBatch.Product.ExtInfo?.Power; |
| | | var Accuracy = WorkBatch.Product.ExtInfo?.Accuracy; |
| | | var Display = WorkBatch.Product.ExtInfo?.Display; |
| | | var Remark = WorkBatch.Product.ExtInfo?.Remark; |
| | | |
| | | return $"{code}|{itemCode}|{wo}|\r\n{snList}|{weight}{unit}|型号:{model},输入:{Input},显示:{Display},输出:{OutPut},电源:{Power},精度:{Accuracy},备注:{Remark}"; |
| | | } |
| | |
| | | int daysOffset = firstDay.DayOfWeek.GetValue() > 3 ? (firstDay.DayOfWeek.GetValue() - 7) : 0; |
| | | int year = date.Year + ((date - firstDay).TotalDays + daysOffset < 0 ? -1 : 0); |
| | | int week = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday); |
| | | dic.Add(sn, $"{year.ToString().Substring(2, 2)}{week:00}"); |
| | | dic.Add(sn, $"{year.ToString("0000").Substring(2, 2)}{week:00}"); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | #region 条码规则方法 |
| | | /// <summary> |
| | | /// 获取根据条码规则生成条码 |
| | | /// </summary> |
| | | /// <param name="ruleCode"></param> |
| | | /// <param name="curAction"></param> |
| | | /// <returns></returns> |
| | | public string GenerateSN(string ruleCode, IWorkAction curAction) |
| | | { |
| | | var rule = Biz.CodeRule[ruleCode ?? ""]; |
| | | if (!rule.IsNullOrEmpty()) |
| | | { |
| | | switch (rule.RULE_CODE) |
| | | { |
| | | case "WhiteBoxNo": |
| | | return rule.Generate("W", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | case "CartonNo": |
| | | return rule.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | default: |
| | | return rule.Generate().Data.ToString() ?? ""; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | #endregion |
| | | #region 包装专用方法 |
| | | /// <summary> |
| | | /// 根据传入的包装对象返回所有的包装实体列表 |
| | | /// </summary> |
| | | /// <param name="parent"></param> |
| | | /// <returns></returns> |
| | | public List<MES_WIP_PKG> GetPackageList(WipPkgItem parent) |
| | | { |
| | | List<MES_WIP_PKG> list = new(); |
| | | if (!parent.Package.IsNullOrEmpty()) |
| | | { |
| | | list.Add(parent.Package); |
| | | } |
| | | foreach (var item in parent.Items) |
| | | { |
| | | item.Package.PARENT_SN = parent.Package?.SN; |
| | | list.AddRange(GetPackageList(item)); |
| | | } |
| | | return list; |
| | | } |
| | | #endregion |
| | | #endregion Functions |
| | | |
| | | public override bool Close(bool needSaveHistoryLog = false) |