| | |
| | | using System.Globalization; |
| | | using Tiger.Business.MES.WorkAction; |
| | | using System.Collections; |
| | | using Tiger.IBusiness.MES.WorkAction; |
| | | using Dm.parser; |
| | | |
| | | namespace Tiger.Business.MES.Transaction |
| | | { |
| | |
| | | } |
| | | 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, batchNo); |
| | | if (!OperInfoDic.ContainsKey(CurBatch.Batch.BATCH_NO)) |
| | |
| | | { |
| | | case "GetSN": |
| | | return CurSN; |
| | | case "GetItemCode": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ITEM_CODE); |
| | | case "GetBAS_ITEM": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.CUST_PROD_CODE); |
| | | case "GetItemName": |
| | |
| | | case "GetPackNumber": |
| | | return GetLabelVarWo(lv, WorkBatch.WO.ORDER_NO); |
| | | case "GetBoxQR": |
| | | return curAction is PackingAction ? GetBoxCode(lvars, curAction as PackingAction) : ""; |
| | | return GetCardOrBoxQR(GetBoxCode(), curAction); |
| | | case "GetCardQR": |
| | | return curAction is PackingAction ? GetCardOrBoxQR(GetCardCode(lvars), lvars, curAction as PackingAction) : ""; |
| | | return GetCardOrBoxQR("", curAction); |
| | | case "GetCardSN": |
| | | List<string> minPkgList = new List<string>(); |
| | | var _pkaction = curAction is PackingAction ? curAction as PackingAction : null; |
| | |
| | | return GetHuaWeiWeek(WorkBatch.Batch.ORDER_NO, list); |
| | | case "GetQty": |
| | | List<string> qtylist = new List<string>(); |
| | | var _qtyAction = curAction is PackingAction ? curAction as PackingAction : null; |
| | | if (_qtyAction != null) |
| | | if (curAction is PackingAction) |
| | | { |
| | | qtylist = GetMinPkgList(_qtyAction); |
| | | qtylist = GetMinPkgList(curAction as PackingAction); |
| | | } |
| | | return $"{qtylist.Count}PCS"; |
| | | 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); |
| | | case "GetInput": |
| | |
| | | var _orderAction = curAction is PackingAction ? curAction as PackingAction : null; |
| | | if (_orderAction != null) |
| | | { |
| | | var snList = _orderAction.CurPkg.Item.GetMinPackageList().Select(q => q.FLOW_SN).ToList(); |
| | | //var snList = _orderAction.CurPkg.Item.GetMinPackageList().Select(q => q.FLOW_SN).ToList(); |
| | | var snList = _orderAction.CurPkg.Item.GetWipSnList().Select(q => q.Value).ToList(); |
| | | if (!snList.Any()) |
| | | { |
| | | snList.Add(_orderAction.CurPkg.CustSN.FLOW_SN); |
| | | snList.Add(_orderAction.CurPkg.CustSN?.FLOW_SN); |
| | | } |
| | | _lotnos = string.Join(",", Biz.Db.Queryable<MES_CUST_SN>() |
| | | .Where((q) => snList.Contains(q.FLOW_SN)) |
| | |
| | | } |
| | | return ""; |
| | | case "GetNOTES": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Remark); |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo?.Remark); |
| | | case "GetXH": |
| | | return GetCardCode(lvars); |
| | | return ""; |
| | | case "GetCardNo": |
| | | return ""; |
| | | case "GetCardTotal": |
| | |
| | | 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); |
| | | } |
| | |
| | | /// <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) |
| | | private string GetCardCode() |
| | | { |
| | | var cardCode = Biz.CodeRule["CartonNo"]?.Generate("B", $"{WorkBatch.Batch.BATCH_NO}-{WorkBatch.Batch.PLAN_QTY}-").Data.ToString() ?? ""; |
| | | return cardCode; |
| | | 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) |
| | | { |
| | | var minPkgList = action.CurPkg.Item.GetMinPackageList().Select(q => q.SN); |
| | | List<string> minPkgList = new List<string>(); |
| | | var itemCode = ""; |
| | | double weight = 0; |
| | | var unit = ""; |
| | | 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 itemCode = action.CurPkg.CustSN?.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; |