| | |
| | | |
| | | public class MESInvItemOutItems |
| | | { |
| | | [SugarColumn(ColumnName = "REMARK")] public string Remark { get; set; } |
| | | [SugarColumn(ColumnName = "REMARK")] public string? Remark { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "PBILL_NO")] public string PbillNo { get; set; } |
| | | [SugarColumn(ColumnName = "PBILL_NO")] public string? PbillNo { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "ITEM_OUT_ID")] |
| | | public string ItemOutId { get; set; } |
| | | public string? ItemOutId { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "RK_QTY")] public decimal RkQty { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "TL_QTY")] public decimal TlQty { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "WORK_LINE")] |
| | | public string WorkLine { get; set; } |
| | | public string? WorkLine { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "QUANTITY")] public decimal Quantity { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "ITEM_NO")] public string ItemNo { get; set; } |
| | | [SugarColumn(ColumnName = "ITEM_NO")] public string? ItemNo { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "KT_QTY")] |
| | | public decimal KtQty { get; set; } // å©ä½å¯é |
| | | |
| | | [SugarColumn(ColumnName = "DEPOT_SECTION_CODE")] |
| | | public string DepotSectionCode { get; set; } |
| | | public string? DepotSectionCode { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "ITEM_MODEL")] |
| | | public string ItemModel { get; set; } |
| | | public string? ItemModel { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "ITEM_NAME")] |
| | | public string ItemName { get; set; } |
| | | public string? ItemName { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "CGB014")] public string Cgb014 { get; set; } |
| | | [SugarColumn(ColumnName = "CGB014")] public string? Cgb014 { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "STAFF_NAME")] |
| | | public string StaffName { get; set; } |
| | | public string? StaffName { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "DEPOT_CODE")] |
| | | public string DepotCode { get; set; } |
| | | public string? DepotCode { get; set; } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using MES.Service.Modes; |
| | | |
| | | namespace MES.Service.Dto.service; |
| | | |
| | | public class ProductionPickDto |
| | | { |
| | | public string? ItemModel { get; set; } |
| | | |
| | | public List<Womdab>? Womdabs{ get; set; } |
| | | } |
| | |
| | | public string? Printnumn { get; set; } |
| | | |
| | | public string? ItemName { get; set; } |
| | | public string? daa001 { get; set; } |
| | | |
| | | public decimal? Num { get; set; } |
| | | } |
| | |
| | | /// å·¥ååå· |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB001")] |
| | | public string Dab001 { get; set; } |
| | | public string? Dab001 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºå· |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB002")] |
| | | public string Dab002 { get; set; } |
| | | public string? Dab002 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ææç¼ç |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB003")] |
| | | public string Dab003 { get; set; } |
| | | public string? Dab003 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ææåç§° |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB004")] |
| | | public string Dab004 { get; set; } |
| | | public string? Dab004 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ææè§æ ¼ |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB005")] |
| | | public string Dab005 { get; set; } |
| | | public string? Dab005 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// éé¢ç¨é |
| | |
| | | /// å·¥èº |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB008")] |
| | | public string Dab008 { get; set; } |
| | | public string? Dab008 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åä½ |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB009")] |
| | | public string Dab009 { get; set; } |
| | | public string? Dab009 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ææç±»å |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB010")] |
| | | public string Dab010 { get; set; } |
| | | public string? Dab010 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 主æ |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB011")] |
| | | public string Dab011 { get; set; } |
| | | public string? Dab011 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç»æç¨é |
| | |
| | | /// æ¯å¦æ¿æ |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB014")] |
| | | public string Dab014 { get; set; } |
| | | public string? Dab014 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¹ä½ |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB015")] |
| | | public string Dab015 { get; set; } |
| | | public string? Dab015 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ææåå· |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB016")] |
| | | public string Dab016 { get; set; } |
| | | public string? Dab016 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºç¼ç |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB017")] |
| | | public string Dab017 { get; set; } |
| | | public string? Dab017 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºåç§° |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB018")] |
| | | public string Dab018 { get; set; } |
| | | public string? Dab018 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 颿æ¹å¼ |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAB019")] |
| | | public string Dab019 { get; set; } |
| | | public string? Dab019 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åºå®æè |
| | |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "ERP_ID")] |
| | | public decimal? ErpId { get; set; } |
| | | |
| | | // å¨ææ·»å ç屿§ |
| | | [SugarColumn(IsIgnore = true)] |
| | | public decimal? wNum { get; set; } |
| | | |
| | | [SugarColumn(IsIgnore = true)] |
| | | public string? ItemName { get; set; } |
| | | |
| | | [SugarColumn(IsIgnore = true)] |
| | | public string? ItemNo { get; set; } |
| | | } |
| | |
| | | { |
| | | return new PurchaseInventory |
| | | { |
| | | ItemIns = GetInvItemInsList(query)[0], |
| | | ItemIns = GetInvItemInsList(query).Items[0], |
| | | ItemInDetails = GetItemInDetails(query.id), |
| | | InvItemInCDetails = GetInvItemInCDetails(query.id) |
| | | }; |
| | | } |
| | | |
| | | public List<MesInvItemIns> GetInvItemInsList(WarehouseQuery query) |
| | | public (List<MesInvItemIns> Items, int TotalCount) GetInvItemInsList( |
| | | WarehouseQuery query) |
| | | { |
| | | return Db.Queryable<MesInvItemIns, MesDepots, MesSupplier>((a, b, c) => |
| | | new JoinQueryInfos(JoinType.Left, a.DepotsCode == b.DepotCode |
| | | && b.Factory == a.Factory |
| | | && b.Company == a.Company, |
| | | JoinType.Left, a.SuppNo == c.SuppNo)) |
| | | var totalCount = 0; |
| | | var result = Db.Queryable<MesInvItemIns, MesDepots, MesSupplier>( |
| | | (a, b, c) => |
| | | new JoinQueryInfos(JoinType.Left, |
| | | a.DepotsCode == b.DepotCode |
| | | && b.Factory == a.Factory |
| | | && b.Company == a.Company, |
| | | JoinType.Left, a.SuppNo == c.SuppNo)) |
| | | .WhereIF(query.id > 0, (a, b, c) => a.Id == query.id) |
| | | .Select((a, b, c) => new MesInvItemIns |
| | | { |
| | |
| | | CreateBy = a.CreateBy, |
| | | DepotName = b.DepotName, |
| | | SuppName = c.SuppName |
| | | }).ToPageList(query.PageIndex, query.Limit); |
| | | }).ToPageList(query.PageIndex, query.Limit, ref totalCount); |
| | | return (result, totalCount); |
| | | } |
| | | |
| | | public List<MesInvItemInCItems> GetItemInDetails(decimal? pid) |
| | |
| | | //å½å类已ç»ç»§æ¿äº Repository å¢ãå ãæ¥ãæ¹çæ¹æ³ |
| | | //è¿éé¢åç代ç ä¸ä¼ç»è¦ç,妿è¦éæ°çæè¯·å é¤ MesInvItemOutsManager.cs |
| | | |
| | | public List<MesInvItemOuts> GetProductionPickPage(WarehouseQuery query) |
| | | public (List<MesInvItemOuts> Items, int TotalCount) GetProductionPickPage(WarehouseQuery query) |
| | | { |
| | | return Db.Queryable<MesInvItemOuts, MesDepots>((a, o) => |
| | | int totalCount = 0; // åå§å totalCount |
| | | // ç¡®ä¿è¿éä½¿ç¨ 'out' æ¥è·åæ»è¡æ° |
| | | var result = Db.Queryable<MesInvItemOuts, MesDepots>((a, o) => |
| | | new JoinQueryInfos( |
| | | JoinType.Left, |
| | | o.DepotCode == a.DepotCode && a.Company == o.Company && |
| | | a.Factory == o.Factory |
| | | a.Factory == a.Factory |
| | | )) |
| | | .Where((a, o) => a.BillTypeId == 200 && |
| | | a.TransactionNo == 201 && |
| | |
| | | ItemOutNo = a.ItemOutNo, |
| | | DepotName = o.DepotName // éè¦å¨ææ·»å çåæ®µ |
| | | }) |
| | | .ToPageList(query.PageIndex, query.Limit); |
| | | .ToPageList(query.PageIndex, query.Limit, ref totalCount); // ç¡®ä¿è¿éä½¿ç¨ 'out' |
| | | |
| | | return (result, totalCount); |
| | | } |
| | | |
| | | public MaterialReceipt GetProductionPick(WarehouseQuery query) |
| | |
| | | if (query.id != null) |
| | | { |
| | | var mesInvItemOutsList = GetProductionPickPage(query); |
| | | if (mesInvItemOutsList.Count <= 0) return form; |
| | | if (mesInvItemOutsList.TotalCount <= 0) return form; |
| | | |
| | | form.ItemOuts = mesInvItemOutsList[0]; |
| | | form.ItemOuts = mesInvItemOutsList.Items[0]; |
| | | form.ItemsList = getProductionItemsList(query); |
| | | form.InvItemoutCDetails = GetProductionDetails(query); |
| | | } |
| | |
| | | using MES.Service.DB; |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | | using SqlSugar; |
| | | |
| | | namespace MES.Service.service; |
| | | |
| | | public class WomdaaManager : Repository<Womdaa> |
| | | { |
| | | //å½å类已ç»ç»§æ¿äº Repository å¢ãå ãæ¥ãæ¹çæ¹æ³ |
| | | //è¿éé¢åç代ç ä¸ä¼ç»è¦ç,妿è¦éæ°çæè¯·å é¤ WomdaaManager.cs |
| | | |
| | | public int TestUpdate(Womdaa womdaa) |
| | | //è·åå·¥åå· |
| | | public List<string> GetProductionPickDaa001(WarehouseQuery query) |
| | | { |
| | | return UseTransaction(db => |
| | | { |
| | | return db.Updateable<Womdaa>() |
| | | .SetColumns(a => a.Daa001 == womdaa.Daa001) |
| | | .SetColumns(a => a.Daa002 == womdaa.Daa002) |
| | | .SetColumns(a => a.Daa003 == womdaa.Daa003) |
| | | .SetColumns(a => a.Daa004 == womdaa.Daa004) |
| | | .Where(a => a.Id == womdaa.Id) |
| | | .ExecuteCommand(); |
| | | }); |
| | | string sql = |
| | | "SELECT DAA001 FROM WOMDAA A LEFT JOIN (SELECT COUNT(1) UN_NUM, PID FROM WOMDAB WHERE DAB006 > DAB007 GROUP BY PID) B ON A.ID = B.PID WHERE DAA001 LIKE '%" + |
| | | query.daa001 + |
| | | "%' and DAA018 != 'å®å·¥' AND DAA022 = 1 AND UN_NUM > 0 AND ROWNUM <= 10 order by a.id desc"; |
| | | |
| | | return Db.Ado.SqlQuery<string>(sql); |
| | | } |
| | | |
| | | //è¿éé¢åç代ç ä¸ä¼ç»è¦ç,妿è¦éæ°çæè¯·å é¤ WomdaaManager.cs |
| | | //æ ¹æ®å·¥åå·è¿å产ååå·åå¾
é¢ç©æ |
| | | public ProductionPickDto GetItemsByDaa001(WarehouseQuery query) |
| | | { |
| | | if (string.IsNullOrEmpty(query.daa001)) |
| | | { |
| | | throw new Exception("å·¥åå·ä¸ºç©º"); |
| | | } |
| | | |
| | | var womdaa = Db.Queryable<Womdaa, MesItems>((a, i) => |
| | | new JoinQueryInfos(JoinType.Left, |
| | | a.Daa002 == i.ItemId.ToString())) |
| | | .Where((a, i) => a.Daa001 == query.daa001) |
| | | .Select((a, i) => new |
| | | { |
| | | i.ItemModel |
| | | }).First(); |
| | | |
| | | if (womdaa?.ItemModel == null) |
| | | { |
| | | throw new Exception("å·¥åå·ä¸åå¨"); |
| | | } |
| | | |
| | | var dto = new ProductionPickDto |
| | | { |
| | | ItemModel = womdaa.ItemModel |
| | | }; |
| | | |
| | | var womdabs = Db.Queryable<Womdaa, Womdab, MesItems>((a, b, c) => |
| | | new JoinQueryInfos( |
| | | JoinType.Left, |
| | | a.Id == b.Pid, // LEFT JOIN WOMDAB B ON A.ID = B.PID |
| | | JoinType.Inner, |
| | | c.Id.ToString() == |
| | | b.Dab003 // INNER JOIN MES_ITEMS C ON C.ID = B.DAB003 |
| | | )) |
| | | .Where((a, b, c) => |
| | | a.Daa001 == query.daa001) // WHERE DAA001 = 'SCDD003681-1' |
| | | .Select((a, b, c) => new Womdab() |
| | | { |
| | | Pid = b.Pid, |
| | | Dab003 = b.Dab003, |
| | | Dab006 = b.Dab006, |
| | | Dab007 = b.Dab007, |
| | | wNum = b.Dab006 - b.Dab007, // 计ç®å段 W_NUM |
| | | ItemName = c.ItemName, // 卿忮µ ITEM_NAME |
| | | ItemNo = c.ItemNo // 卿忮µ ITEM_NO |
| | | }) |
| | | .ToList(); |
| | | |
| | | dto.Womdabs = womdabs; |
| | | return dto; |
| | | } |
| | | } |
| | |
| | | //è¿åçæ°æ® |
| | | public object data { get; set; } |
| | | |
| | | public int TotalCount { get; set; } = 0; |
| | | |
| | | //失败çè¿åç»æ |
| | | public static ResponseResult ResponseError(Exception e) |
| | | { |
| | |
| | | using System.Dynamic; |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | | using MES.Service.service.Warehouse; |
| | | using MES.Service.util; |
| | |
| | | |
| | | /***è¿å
¥æ¨¡ç管çå¯ä»¥ä¿®æ¹æ¨¡ç***/ |
| | | |
| | | //GetBarCodesQuan |
| | | /// <summary> |
| | | /// æ ¹æ®æ¡ç è·åæ°é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("GetBarCodesQuan")] |
| | | public ResponseResult GetBarCodesQuan(WarehouseQuery query) |
| | | { |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | resultInfos.tbBillList = m.GetBarCodesQuan(query); |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | resultInfos.tbBillList = m.GetInvItemInsList(entity); |
| | | var (items, totalCount) = m.GetInvItemInsList(entity); |
| | | resultInfos.tbBillList = items; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | data = resultInfos, |
| | | TotalCount = totalCount |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | resultInfos.tbBillList = m.GetProductionPickPage(entity); |
| | | var productionPickPage = m.GetProductionPickPage(entity); |
| | | resultInfos.tbBillList = productionPickPage.Items; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | data = resultInfos, |
| | | TotalCount = productionPickPage.TotalCount |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | using System.Dynamic; |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | | using MES.Service.service; |
| | | using MES.Service.util; |
| | |
| | | public class WomdaaController : ControllerBase |
| | | { |
| | | private readonly WomdaaManager m = new(); |
| | | |
| | | //TestUpdate |
| | | [HttpPost("TestUpdate")] |
| | | public ResponseResult TestUpdate([FromBody] Womdaa data) |
| | | |
| | | #region çäº§é¢æ |
| | | //GetProductionPickDaa001 |
| | | /// <summary> |
| | | /// æ¨¡ç³æ¥è¯¢å·¥åå·å¹¶è¿å |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("GetProductionPickDaa001")] |
| | | public ResponseResult GetProductionPickDaa001(WarehouseQuery query) |
| | | { |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | resultInfos.tbBillList = m.TestUpdate(data); |
| | | resultInfos.tbBillList = m.GetProductionPickDaa001(query); |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | |
| | | //GetItemsByDaa001 |
| | | /// <summary> |
| | | /// æ ¹æ®å·¥åå·è·å代é¢ç©ææç» |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("GetItemsByDaa001")] |
| | | public ResponseResult GetItemsByDaa001(WarehouseQuery query) |
| | | { |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | resultInfos.tbBillList = m.GetItemsByDaa001(query); |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åææ |
| | | /// </summary> |
| | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | #endregion |
| | | } |