| | |
| | | using static Tiger.Business.Biz; |
| | | using Tiger.Model.Entitys.MES.Position; |
| | | using System.Globalization; |
| | | using Tiger.Business.MES.WorkAction; |
| | | |
| | | namespace Tiger.Business.MES.Transaction |
| | | { |
| | |
| | | /// <returns></returns> |
| | | public BAS_LABEL_TEMP SetLabelVariables(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_TEMP label, IWorkAction action) |
| | | { |
| | | foreach (var item in label.Variables) |
| | | 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, action); |
| | | item.Value = GetPrintProcessValue(labelPVs, item, label.Variables, action); |
| | | 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, IWorkAction action) |
| | | public string GetPrintProcessValue(List<BAS_LABEL_PV> labelPVs, BAS_LABEL_VAR lv, List<BAS_LABEL_VAR> lvars, IWorkAction action) |
| | | { |
| | | var pv = labelPVs.FirstOrDefault(q => q.VAR_CODE == lv.VAR_VALUE); |
| | | if (!pv.IsNullOrEmpty()) |
| | |
| | | case "GetSN": |
| | | return CurSN; |
| | | case "GetBAS_ITEM": |
| | | return WorkBatch.Product.ToJson(); |
| | | return WorkBatch.Product.ITEM_CODE; |
| | | case "GetCustomer": |
| | | return WorkBatch.Batch.ToJson(); |
| | | case "GetBoxQR": |
| | | return action is PackingAction ? GetBoxCode(lvars, action as PackingAction) : ""; |
| | | case "GetCardQR": |
| | | return action is PackingAction? GetCardCode(lvars, action as PackingAction) : ""; |
| | | case "GetDescription": |
| | | return WorkBatch.Product.ITEM_DESC; |
| | | case "GetPAndO": |
| | | return WorkBatch.WO.SALES_CONTRACT; |
| | | case "GetLTD": |
| | | return WorkBatch.Batch.Customer.SHORT_NAME; |
| | | case "GetHWDate": |
| | | return WorkBatch.Batch.ToJson(); |
| | | case "GetModel": |
| | | return GetLabelVarWo(lv, WorkBatch.Product.ExtInfo.Model); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取白盒条码 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private string GetBoxCode(List<BAS_LABEL_VAR> lvars, PackingAction action) |
| | | { |
| | | return GetCardOrBoxQR(CurSN, lvars, action); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取箱条码 |
| | | /// </summary> |
| | | /// <param name="lvars"></param> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private string GetCardCode(List<BAS_LABEL_VAR> lvars, PackingAction action) |
| | | { |
| | | var cardCode = lvars.First(q=>q.VAR_NAME == "CardQR").Value; |
| | | return GetCardOrBoxQR(cardCode, lvars, action); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取白盒或者箱二维码 |
| | | /// </summary> |
| | | /// <param name="code"></param> |
| | | /// <param name="lvars"></param> |
| | | /// <param name="action"></param> |
| | | /// <returns></returns> |
| | | private string GetCardOrBoxQR(string code, List<BAS_LABEL_VAR> lvars, PackingAction action) |
| | | { |
| | | var itemCode = WorkBatch.Product.ITEM_CODE; |
| | | var wo = WorkBatch.Batch.ORDER_NO; |
| | | var snList = string.Join("\r\n", action.GetMinPackageList(action.CurPkg.Item).Select(q => q.SN)); |
| | | 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 Remark = WorkBatch.Product.ExtInfo.Remark; |
| | | |
| | | return $"{code}|{itemCode}|{wo}|{snList}|{weight}|型号:{model},输入:{Input},输出:{OutPut},电源:{Power},精度:{Accuracy},备注:{Remark}"; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据包装工单和条码获取华为要求的生产周期 |
| | | /// </summary> |
| | | /// <param name="snList"></param> |