| | |
| | | public async Task<ApiAction<PageAble<BIZ_U9_RECEIPT>>> GetOrderList(BaseInputWithPage input) |
| | | { |
| | | var action = new ApiAction<PageAble<BIZ_U9_RECEIPT>>(); |
| | | var query = Biz.DataSource["YadaU9C"].Client.Queryable<mes_ReturnedDocInfo>().Where(q => q.Status == 3) |
| | | .WhereIF(!input.OrderNo.IsNullOrEmpty(), q => q.DocNo.Contains(input.OrderNo) || SqlFunc.Subqueryable<mes_AsnDocInfo>().Where(a => a.AsnId == q.SrcASNDocId && q.DocNo.Contains(input.OrderNo)).Any()) |
| | | var asns = MainDB.Queryable<BIZ_U9_ASN>().Where(q => q.ORDER_NO.Contains(input.OrderNo.IsNullOrEmpty("没有单号不查询ASN单"))).Select(q => q.ID).ToList().IsNullOrEmpty(new() { "查询不到ASN单" }); |
| | | var query = Biz.DataSource["YadaU9C"].Client.Queryable<mes_ReturnedDocInfo>().Where(q => q.Status == 3)//查询状态是审核中得收货单 |
| | | //.WhereIF(!input.OrderNo.IsNullOrEmpty(), q => q.DocNo.Contains(input.OrderNo) || SqlFunc.Subqueryable<mes_AsnDocInfo>().Where(a => a.AsnId == q.SrcASNDocId && q.DocNo.Contains(input.OrderNo)).Any()) |
| | | .WhereIF(!input.OrderNo.IsNullOrEmpty(), q => q.DocNo.Contains(input.OrderNo) || asns.Contains(q.SrcASNDocId.ToString())) |
| | | .OrderBy(q => q.DocNo).Select(q => new { q.DocNo, q.Status, q.StatusName }).Distinct().ToList(); |
| | | |
| | | action.Data = await MainDB.Queryable<BIZ_U9_RECEIPT>().Where(q => query.Select(o => o.DocNo).Contains(q.ORDER_NO)).ToPageAsync(input.pageIndex, input.pageSize); |
| | | foreach (var order in action.Data.data) |
| | | { |
| | | order.ERP_STATUS_CODE = query.FirstOrDefault(q => q.DocNo == order.ORDER_NO)?.Status.ToString(); |
| | | order.ERP_STATUS_NAME = query.FirstOrDefault(q => q.DocNo == order.ORDER_NO)?.StatusName; |
| | | var u9Order = query.FirstOrDefault(q => q.DocNo == order.ORDER_NO); |
| | | order.ERP_STATUS_CODE = u9Order?.Status.ToString(); |
| | | order.ERP_STATUS_NAME = u9Order?.StatusName; |
| | | } |
| | | MainDB.Updateable(action.Data.data, UserCode).UpdateColumns(q => new { q.UPDATE_TIME, q.UPDATE_USER, q.ERP_STATUS_CODE, q.ERP_STATUS_NAME }).ExecuteCommand(); |
| | | return action; |