| | |
| | | using Microsoft.AspNetCore.Mvc.RazorPages; |
| | | using System.Drawing.Printing; |
| | | using System.Net.NetworkInformation; |
| | | using Tiger.Model.MES.Yada; |
| | | |
| | | namespace Tiger.Business.MES |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction<LOG_LABEL_PRINT>> GetRePrintInfo(RePrintInput input) |
| | | public async Task<ApiAction> GetRePrintInfo(RePrintInput input) |
| | | { |
| | | var result = new ApiAction<LOG_LABEL_PRINT>(); |
| | | var result = new ApiAction(); |
| | | try |
| | | { |
| | | //先查出工单条码中是否存在 |
| | |
| | | result.LocaleMsg = new($"条码不存在!"); |
| | | return result; |
| | | } |
| | | |
| | | result.Data = await Biz.Db.Queryable<LOG_LABEL_PRINT>() |
| | | string printParam = ""; |
| | | var labelPrint = await Biz.Db.Queryable<LOG_LABEL_PRINT>() |
| | | .WhereIF(input.ReqType == 0, q => q.SN.Equals(woSn.SN) || q.SN.Equals(woSn.FLOW_SN)) //白盒标签 |
| | | .WhereIF(input.ReqType == 1, q => q.SN.Equals(woSn.OUTER_SN)) //箱标签 |
| | | .WhereIF(input.ReqType == 1, q => q.SN.Equals(woSn.OUTER_SN) && q.PRINT_LABEL != "InStoreLabel") //箱标签-客户 |
| | | .WhereIF(input.ReqType == 2, q => q.SN.Equals(woSn.OUTER_SN) && q.PRINT_LABEL == "InStoreLabel") //箱标签-入库 |
| | | .FirstAsync(); |
| | | //如果查不到就去行为日志查 |
| | | if (labelPrint.IsNullOrEmpty() && input.ReqType == 1) |
| | | { |
| | | printParam = Biz.Db.Queryable<MES_WIP_ACT>().Where(q => (q.SN.Equals(input.Code) || q.FLOW_SN.Equals(input.Code)) && q.ACT_VALUE_4 == "Customer").First()?.ACT_VALUE_3 ?? ""; |
| | | } |
| | | else |
| | | { |
| | | printParam = labelPrint.PRINT_PARAM; |
| | | } |
| | | result.Data = printParam; |
| | | result.LocaleMsg = new($"重打条码[{input.Code}]的标签成功"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取出货信息 |
| | | /// </summary> |
| | | /// <param name="wo"></param> |
| | | /// <returns></returns> |
| | | public async Task<ApiAction> GetShipList(string wo, string orgCode) |
| | | { |
| | | var result = new ApiAction(); |
| | | try |
| | | { |
| | | DbClient db = Biz.DataSource["YadaU9C"].Client; |
| | | var org = await Biz.Db.Queryable<SYS_ORGANIZATION>().Where(q=>q.ORG_CODE == orgCode).FirstAsync(); |
| | | if (db.Queryable<mes_ShipList>().Any(q => q.MoDoc.Equals(wo) && SqlFunc.DateIsSame(q.BusinessDate, DateTime.Now) && q.Status == 2 && q.Org == org.ID.ToInt64())) |
| | | { |
| | | result.Data = "Customer"; |
| | | } |
| | | else |
| | | { |
| | | result.LocaleMsg = new($"出货信息存在!"); |
| | | result.Data = "InStoreLabel"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, "获取出货信息异常"); |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | | } |