1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
| using Gs.Entity.BaseInfo;
| using Gs.Entity.QC;
| using Gs.Toolbox;
| using Gs.Toolbox.ApiCore.Abstract.Mvc;
| using Gs.Toolbox.ApiCore.Common.Mvc;
| using Gs.Toolbox.ApiCore.Group;
| using Gs.Warehouse.Models;
| using Microsoft.AspNetCore.Http;
| using Newtonsoft.Json.Linq;
| using SqlSugar;
|
| namespace Gs.Warehouse.Services;
|
| [ApiGroup(ApiGroupNames.PerMission)]
| //采购到货单明细表
| public class MesInvItemArnDetailManager : Repository<MesInvItemArnDetail>,
| IRomteService
| {
| private readonly IHttpContextAccessor _http;
| private readonly string _userCode,_userGuid,_orgFids;
|
| public MesInvItemArnDetailManager(IHttpContextAccessor httpContextAccessor)
| {
| _http = httpContextAccessor;
| (_userCode, _userGuid, _orgFids) =
| UtilityHelper.GetUserGuidAndOrgGuid(_http);
| }
|
|
| /// <summary>
| /// 根据用户选择的采购明细guid,读取需要作入库到货单的明细
| /// </summary>
| /// <param name="query"></param>
| /// <returns></returns>
| [RequestMethod(RequestMethods.POST)]
| public ReturnDto<List<MesInvItemArnDetail>> GetListPageByCgmxGuid(
| JArray guidList)
| {
| var intArray = guidList.ToObject<string[]>();
| var _lst = new List<MesInvItemArnDetail>();
| var mesRohInDatas =
| Db.Queryable<MesRohInData, MesItems>((a, b) => new object[]
| {
| JoinType.Left, a.ItemId == b.Id.ToString(),
| }).Select((a, b) => new MesRohInData()
| {
| itemModel = b.ItemModel,
| itemNo = b.ItemNo,
| itemName = b.ItemName,
| }, true).In("a.Guid", intArray).ToList();
| try
| {
| foreach (var _ddd in mesRohInDatas)
| //把采购单的数据,附加给采购到货单
| //需要这些:采购时间,采购单号,采购单行号,物料编码,物料名称,物料规格,采购订单数量,本次应收数量,本次实收数量 ,采购单位,库存单位,采购订单id,采购订单行id,
| _lst.Add(new MesInvItemArnDetail
| {
| Guid = null,
| ParentGuid = null,
| AboutGuid = _ddd.Guid,
| Ebeln = _ddd.BillNo,
| //EbelnLine = string.IsNullOrEmpty(_ddd.OrderLineId) ? 0 : int.Parse(_ddd.OrderLineId),
| // ItemNo = _ddd.ItemId,
| ItemId = int.Parse(_ddd.ItemId),
| EbelnQty = _ddd.PurchaseQty,
| SubQty = _ddd.RemainingReceivedQty,
| EbelnK3id = _ddd.EbelnK3id,
| EbelnLine = null,
| Quantity = 0,
| CreateBy = null,
| CreateDate = null,
| LastupdateBy = null,
| LastupdateDate = null,
| Factory = null,
| Company = null,
| LineK3id = null,
| MarginQty = null,
| WorkNo = null,
| UrgentFlag = false,
| Memo = null,
| CheckRes = null,
| CheckStates = null,
| QuantityM = null,
| SubMqty = null,
| CheckDate = null,
| Ischeck = null,
| OkQty = null,
| OkMqty = null,
| BoardStyle = null,
| WorkLine = null,
| FType = null,
| IsdepsIn = false,
| Dha001 = null,
| OkRkqty = null,
| CbillNo = null,
| CgRkqty = null,
| ReturnFlag = 0,
| States = null,
| itemModel = _ddd.itemModel,
| itemName = _ddd.itemName,
| ItemNo = _ddd.itemNo,
| });
| }
| catch (Exception ex)
| {
| LogHelper.Debug(ToString(), ex.Message);
| }
|
| return ReturnDto<List<MesInvItemArnDetail>>.QuickReturn(_lst,
| ReturnCode.Success, "读取成功");
| }
| }
|
|