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
| using MES.Service.DB;
| using MES.Service.Dto.service;
| using MES.Service.Modes;
| using SqlSugar;
|
| namespace MES.Service.service.Warehouse;
|
| public class MesInvItemMovesManager : Repository<MesInvItemMoves>
| {
| //当前类已经继承了 Repository 增、删、查、改的方法
|
| //这里面写的代码不会给覆盖,如果要重新生成请删除 MesInvItemMovesManager.cs
|
| public List<MesInvItemMoves> GetBillNo(WarehouseQuery query)
| {
| query.Factory = "1000";
| query.Company = "1000";
|
| return Db.Queryable<MesInvItemMoves>()
| .Where(it =>
| SqlFunc.IsNull(it.Status, 0) == 1 &&
| SqlFunc.IsNull(it.Ts, 0) != 1)
| .Where(it =>
| it.Factory == query.Factory && it.Company == query.Company)
| .OrderBy(it => it.Id, OrderByType.Desc).ToList();
| }
|
| //scan_out_show_DB
| public List<InventoryItem> ScanOutShowDb(WarehouseQuery query)
| {
| var BillTypeId = 300;
| var TransctionNo = 301;
| query.Factory = "1000";
| query.Company = "1000";
|
| var sql = string.Format(
| "select f_get_sections_code({0}, {1}, b.item_no) sections_code , s.erp_item_no , S.ITEM_MODEL , to_char(nvl(b.quantity, 0) - nvl(quantity_ok, 0), 'FM9999999990.00') flist from mes_inv_item_moves a join mes_inv_item_out_items b on b.item_out_id = a.id join mes_items s on b.item_no = s.item_no left join (select ITEM_MOVE_ID, item_no, sum(quantity) quantity_ok from MES_INV_ITEM_MOVES_C_DETAILS group by ITEM_MOVE_ID, item_no) c on c.ITEM_MOVE_ID = a.id and b.item_no = c.item_no where 1 = 1 and a.bill_type_id = {2} and a.transaction_no = {3} and a.bill_no = {4} and nvl(b.quantity, 0) - nvl(quantity_ok, 0) > 0 and rownum < 500 AND A.STATUS = 1 order by f_get_sections_code({0}, {1}, b.item_no), s.erp_item_no ",
| query.Factory, query.Company, BillTypeId, TransctionNo,
| query.billNo);
|
| var results = Db.Ado.SqlQuery<InventoryItem>(sql);
|
| return results;
| }
| }
|
|