procurementExecution.ts 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. import service from '/@/utils/request';
  2. export interface Paged<T> {
  3. total: number;
  4. page: number;
  5. pageSize: number;
  6. list: T[];
  7. }
  8. export interface SupplierDeliveryRow {
  9. id?: string;
  10. sffb?: string;
  11. wlbm?: string;
  12. wlms?: string;
  13. buyer?: string;
  14. gysdm?: string;
  15. gysmc?: string;
  16. cgdd?: string;
  17. ddhh?: number;
  18. jhdsl?: number;
  19. dfhsl?: number;
  20. dsnum?: string;
  21. requestdate?: string;
  22. schedqty?: number;
  23. jqhfnew?: string;
  24. ztsl?: number;
  25. zsl1?: number;
  26. rksl?: number;
  27. bhgsl?: number;
  28. thsl?: number;
  29. bz?: string;
  30. }
  31. export interface SupplierShipmentRow {
  32. mid: number;
  33. id: number;
  34. shddh?: string;
  35. poBill?: string;
  36. usage?: string;
  37. jhshrq?: string;
  38. shMaterialCode?: string;
  39. shMaterialName?: string;
  40. shDeliveryQuantity?: number;
  41. sfpc?: number;
  42. pcrksl?: number;
  43. shPurchaseName?: string;
  44. shpc?: string;
  45. scph?: string;
  46. wldh?: string;
  47. dycs?: number;
  48. shzt?: string;
  49. th?: string;
  50. state?: number;
  51. }
  52. export interface SupplierShipmentDetailRow {
  53. id?: number | null;
  54. hh?: number | null;
  55. poBill?: string;
  56. poBillLine?: string;
  57. orderType?: string;
  58. shMaterialCode?: string;
  59. shMaterialName?: string;
  60. th?: string;
  61. shDeliveryQuantity?: number | null;
  62. bzsl?: number | null;
  63. bqsl?: number | null;
  64. shMaterialDw?: string;
  65. scrq?: string;
  66. scph?: string;
  67. remarks?: string;
  68. djsl?: number | null;
  69. jybb?: string;
  70. jhdbh?: string;
  71. }
  72. export interface SupplierShipmentFormData {
  73. id?: number | null;
  74. shddh?: string;
  75. jhshrq?: string;
  76. wlsc?: string;
  77. yjdhrq?: string;
  78. shPurchaseName?: string;
  79. shPurchaseNum?: string;
  80. wldh?: string;
  81. sfpc?: number;
  82. chbg?: string;
  83. pcsm?: string;
  84. details: SupplierShipmentDetailRow[];
  85. }
  86. export function fetchSupplierDeliveryList(params: any) {
  87. return service.get<Paged<SupplierDeliveryRow>>('/api/ProcurementExecution/supplier-delivery/list', { params }).then((r) => r.data);
  88. }
  89. export function publishSupplierDelivery(ids: string) {
  90. return service.post('/api/ProcurementExecution/supplier-delivery/publish', { ids }).then((r) => r.data);
  91. }
  92. export function replySupplierDeliveryByPlanDate(ids: string) {
  93. return service.post('/api/ProcurementExecution/supplier-delivery/reply-by-plan-date', { ids }).then((r) => r.data);
  94. }
  95. export function replySupplierDeliveryDueDate(ids: string, jqhf: string) {
  96. return service.post('/api/ProcurementExecution/supplier-delivery/reply-due-date', { ids, jqhf }).then((r) => r.data);
  97. }
  98. export function closeDeliveryOrder(dsNum: string) {
  99. return service.post('/api/ProcurementExecution/supplier-delivery/close', { dsNum }).then((r) => r.data);
  100. }
  101. export function fetchSupplierShipmentList(params: any) {
  102. return service.get<Paged<SupplierShipmentRow>>('/api/ProcurementExecution/supplier-shipment/list', { params }).then((r) => r.data);
  103. }
  104. export function fetchSupplierShipmentDetail(id: number) {
  105. return service.get<SupplierShipmentFormData>(`/api/ProcurementExecution/supplier-shipment/${id}`).then((r) => r.data);
  106. }
  107. export function fetchSupplierShipmentDraft(ids: string) {
  108. return service.get<SupplierShipmentFormData>('/api/ProcurementExecution/supplier-shipment/create-draft', { params: { ids } }).then((r) => r.data);
  109. }
  110. export function saveSupplierShipment(body: SupplierShipmentFormData) {
  111. return service.post('/api/ProcurementExecution/supplier-shipment/save', body).then((r) => {
  112. const d = r.data as { result?: { id?: number; message?: string; shddh?: string }; shddh?: string };
  113. return d?.result ?? d;
  114. });
  115. }
  116. export function deleteSupplierShipment(id: number) {
  117. return service.post('/api/ProcurementExecution/supplier-shipment/delete', { id }).then((r) => r.data);
  118. }
  119. export function shipmentPlaceholderAction(action: 'generate-label' | 'print-shipping-note' | 'print-label', id: number) {
  120. return service.post(`/api/ProcurementExecution/supplier-shipment/${action}`, { id }).then((r) => r.data);
  121. }
  122. export interface SupplierShipmentLabelRow {
  123. glid?: number | null;
  124. wlbm?: string | null;
  125. wlmc?: string | null;
  126. ggxh?: string | null;
  127. zxsl?: number | null;
  128. dw?: string | null;
  129. remarks?: string | null;
  130. bz?: number | null;
  131. ddlx?: string | null;
  132. ddh?: string | null;
  133. shdh?: string | null;
  134. shdhh?: string | null;
  135. scrq?: string | null;
  136. scph?: string | null;
  137. xh?: string | null;
  138. gysmc?: string | null;
  139. th?: string | null;
  140. bbh?: string | null;
  141. yt?: string | null;
  142. ccrq?: string | null;
  143. shpc?: string | null;
  144. }
  145. export function fetchSupplierShipmentLabelData(shddh: string) {
  146. return service
  147. .get<{ list: SupplierShipmentLabelRow[] }>(`/api/ProcurementExecution/supplier-shipment/label-data`, { params: { shddh } })
  148. .then((r) => r.data);
  149. }
  150. // ── S4 采购退货单 ──
  151. export interface PurchaseReturnListRow {
  152. id?: number;
  153. detailRecId?: number;
  154. receiver?: string;
  155. suppName?: string;
  156. rctDate?: string;
  157. ordNbr?: string;
  158. itemNum?: string;
  159. descr?: string;
  160. descr1?: string;
  161. rctQty?: number;
  162. isPlan?: boolean;
  163. }
  164. export interface PurchaseReturnKv {
  165. value?: string;
  166. label?: string;
  167. }
  168. export interface PurchaseReturnDetailRow {
  169. recID?: number | null;
  170. line?: number;
  171. itemNum?: string;
  172. ordNbr?: string;
  173. ordLine?: number;
  174. qtyOrded?: number;
  175. qtyReceived?: number;
  176. rctQty?: number;
  177. lotSerial?: string;
  178. um?: string;
  179. location?: string;
  180. qcDescr?: string;
  181. remark?: string;
  182. rctDate?: string;
  183. typed?: string;
  184. taxIn?: boolean;
  185. taxClass?: string;
  186. curr?: string;
  187. potype?: string;
  188. qtyReturn?: number;
  189. rctNbr?: string;
  190. rctLine?: number;
  191. custPO?: string;
  192. blanketLine?: number;
  193. umConversion?: number;
  194. poCost?: number;
  195. supp?: string;
  196. _edit?: boolean;
  197. }
  198. export function fetchPurchaseReturnList(params: any) {
  199. return service.get<Paged<PurchaseReturnListRow>>('/api/ProcurementExecution/purchase-return/list', { params }).then((r) => r.data);
  200. }
  201. export function fetchPurchaseReturnDetail(id: number) {
  202. return service.get<{ master: Record<string, any>; details: PurchaseReturnDetailRow[] }>(`/api/ProcurementExecution/purchase-return/${id}`).then((r) => r.data);
  203. }
  204. export function savePurchaseReturn(body: any) {
  205. return service.post<{ id: number; receiver?: string }>('/api/ProcurementExecution/purchase-return/save', body).then((r) => r.data);
  206. }
  207. export function deletePurchaseReturn(id: number) {
  208. return service.post<{ message?: string }>(`/api/ProcurementExecution/purchase-return/delete/${id}`).then((r) => r.data);
  209. }
  210. export function fetchPurchaseReturnSuppliers() {
  211. return service.get<PurchaseReturnKv[]>('/api/ProcurementExecution/purchase-return/options/suppliers').then((r) => r.data);
  212. }
  213. export function fetchPurchaseReturnRcReceivers(supp: string) {
  214. return service.get<PurchaseReturnKv[]>('/api/ProcurementExecution/purchase-return/options/rc-receivers', { params: { supp } }).then((r) => r.data);
  215. }
  216. export function fetchPurchaseReturnRcLines(receiver: string) {
  217. return service
  218. .get<{ head?: Record<string, any>; lines: PurchaseReturnDetailRow[] }>('/api/ProcurementExecution/purchase-return/rc-detail-lines', {
  219. params: { receiver },
  220. })
  221. .then((r) => r.data);
  222. }
  223. export function fetchPurchaseReturnDepartments() {
  224. return service.get<PurchaseReturnKv[]>('/api/ProcurementExecution/purchase-return/options/departments').then((r) => r.data);
  225. }
  226. export function fetchPurchaseReturnLocations() {
  227. return service.get<PurchaseReturnKv[]>('/api/ProcurementExecution/purchase-return/options/locations').then((r) => r.data);
  228. }
  229. export function fetchPurchaseReturnQcReasons() {
  230. return service.get<PurchaseReturnKv[]>('/api/ProcurementExecution/purchase-return/options/qc-reasons').then((r) => r.data);
  231. }
  232. export function fetchPurchaseReturnItemOptions(params: { keyword?: string; page?: number; pageSize?: number }) {
  233. return service
  234. .get<{ total: number; page: number; pageSize: number; list: PurchaseReturnKv[] }>(`/api/ProcurementExecution/purchase-return/item-options`, {
  235. params,
  236. })
  237. .then((r) => r.data);
  238. }
  239. // ── S4 IQC退货查询(只读)──
  240. export interface IqcReturnListRow {
  241. rowKey?: string;
  242. entryId?: number;
  243. fBillNo?: string;
  244. ordNbr?: string;
  245. pch?: string;
  246. fMaterialCfg?: string;
  247. sortName?: string;
  248. supp?: string;
  249. gysmc?: string;
  250. wlmc?: string;
  251. ggxh?: string;
  252. frInsQty?: number;
  253. bhgsl?: number;
  254. clfs?: number;
  255. thyy?: string;
  256. fInspectStatus?: string;
  257. fApplyTime?: string;
  258. fInspeEndDate?: string;
  259. }
  260. export function fetchIqcReturnList(params: any) {
  261. return service.get<Paged<IqcReturnListRow>>('/api/ProcurementExecution/iqc-return/list', { params }).then((r) => r.data);
  262. }
  263. // ── S4 供应商欠料看板(只读)──
  264. export interface SupplierShortageKanbanRow {
  265. rowNum?: number;
  266. supplier_Number?: string;
  267. supplier_Name?: string;
  268. itemNum?: string;
  269. descr?: string;
  270. descr1?: string;
  271. d0?: number;
  272. d1?: number;
  273. d2?: number;
  274. d3?: number;
  275. d4?: number;
  276. d5?: number;
  277. d6?: number;
  278. d7?: number;
  279. d8?: number;
  280. d9?: number;
  281. d10?: number;
  282. d11?: number;
  283. d12?: number;
  284. d13?: number;
  285. d14?: number;
  286. }
  287. export function fetchSupplierShortageKanbanList(params: any) {
  288. return service
  289. .get<Paged<SupplierShortageKanbanRow>>('/api/ProcurementExecution/supplier-shortage-kanban/list', { params })
  290. .then((r) => r.data);
  291. }
  292. export function refreshSupplierShortageKanban() {
  293. return service.post<{ ok: boolean; elapsedMs?: number; message?: string }>('/api/ProcurementExecution/supplier-shortage-kanban/refresh').then((r) => r.data);
  294. }