index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <!-- 采购合同-入库登记-->
  3. <a-modal class="commonModal" title="采购合同-入库登记" v-model:visible="visible" centered @cancel="cancel" width="890px">
  4. <template #footer>
  5. <a-button key="submit" class="cancelBtn" @click="cancel">取消</a-button>
  6. <a-button key="submit" type="primary" :loading="loading" @click="submit">入库登记</a-button>
  7. </template>
  8. <a-form class="inlineForm" ref="formRef" :model="formState" :rules="rules">
  9. <fieldset class="formFieldSet">
  10. <legend>合同基本信息</legend>
  11. <a-row :gutter="24">
  12. <a-col :span="12">
  13. <a-form-item label="合同编号">
  14. <span class="white">{{ formatValue(selectedRow.contractno) }}</span>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :span="12">
  18. <a-form-item :label="selectedRow.contracttype === 1 ? '采购方' : '销售方'">
  19. <span class="white">{{ formatValue(selectedRow.accountname) }}</span>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :span="12">
  23. <a-form-item label="现货品种">
  24. <span class="white">{{ formatValue(selectedRow.deliverygoodsname) }}</span>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :span="12">
  28. <a-form-item label="合同签署量">
  29. <span class="white">{{ formatValue(selectedRow.qty) }}</span>
  30. </a-form-item>
  31. </a-col>
  32. </a-row>
  33. </fieldset>
  34. <fieldset class="formFieldSet">
  35. <legend>已登记信息</legend>
  36. <a-row :gutter="24">
  37. <a-col :span="12" v-for="(item, i) in DGList" :key="i">
  38. <a-form-item label="已入库量">
  39. <span class="white">{{item.wrstandardname}} + {{item.brandname}} ({{item.totalqty + selectedRow.enumdicname}})</span>
  40. </a-form-item>
  41. </a-col>
  42. <!-- <a-col :span="12">
  43. <a-form-item label="已入库量2">
  44. <span class="white">品类2+品牌2(66吨)</span>
  45. </a-form-item>
  46. </a-col>
  47. <a-col :span="12">
  48. <a-form-item label="已入库量3">
  49. <span class="white">品类3+品牌3(1000吨)</span>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :span="12">
  53. <a-form-item label="已入库量4">
  54. <span class="white">品类4+品牌4(5吨)</span>
  55. </a-form-item>
  56. </a-col> -->
  57. </a-row>
  58. </fieldset>
  59. <fieldset class="formFieldSet">
  60. <legend>本次入库信息</legend>
  61. <a-row :gutter="24">
  62. <a-col :span="12">
  63. <a-form-item label="商品">
  64. <a-select class="inlineFormSelect" style="width: 200px" placeholder="请选择品类" v-model:value="selectedRow.wrstandardid" readonly>
  65. <a-select-option v-for="option in gmlist" :key="option.wrstandardid" :value="option.wrstandardid">{{ option.wrstandardname }} </a-select-option>
  66. </a-select>
  67. </a-form-item>
  68. </a-col>
  69. <a-col :span="12">
  70. <a-form-item label="品牌" name="SpotGoodsBrandID">
  71. <a-select class="inlineFormSelect" style="width: 200px" placeholder="请选择品牌" v-model:value="formState.SpotGoodsBrandID">
  72. <a-select-option v-for="option in gblist" :key="option.brandid" :value="option.brandid">{{ option.brandname }}</a-select-option>
  73. </a-select>
  74. </a-form-item>
  75. </a-col>
  76. <a-col :span="12">
  77. <a-form-item label="入库仓库" name="WarehouseInfo">
  78. <a-select class="inlineFormSelect" style="width: 200px" placeholder="请选择入库仓库" v-model:value="formState.WarehouseInfo">
  79. <a-select-option v-for="option in wareHouseList" :key="option.autoid" :value="option.autoid">{{ option.warehousecode }}</a-select-option>
  80. </a-select>
  81. </a-form-item>
  82. </a-col>
  83. <a-col :span="12">
  84. <a-form-item label="入库数量" name="Qty">
  85. <a-input-number class="dialogInput" style="width: 200px" suffix="单位" :min="0" placeholder="请输入入库数量" v-model:value="formState.Qty"> </a-input-number>
  86. </a-form-item>
  87. </a-col>
  88. </a-row>
  89. </fieldset>
  90. </a-form>
  91. </a-modal>
  92. </template>
  93. <script lang="ts">
  94. import { defineComponent, PropType, ref, unref } from 'vue';
  95. import { Ermcp3SellBuyContract } from '@/services/go/ermcp/purchase/interface';
  96. import { ERMCPAreaInOutStockApplyReq } from '@/services/proto/warehouse/interface';
  97. import { QueryAreaStockApply, QueryWareHouse } from '@/services/go/ermcp/warehouse-info/index';
  98. import * as Long from 'long';
  99. import { formatValue } from '@/common/methods';
  100. import { handleForm } from './setup';
  101. import APP from '@/services';
  102. import { ErmcpWareHouseInfo } from '@/views/information/warehouse-info/list';
  103. import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
  104. import { message } from 'ant-design-vue';
  105. import { Ermcp3AreaStockApplySum } from '@/services/go/ermcp/warehouse-info/interface';
  106. import { ermcpInOutStockApplyReq } from '@/services/proto/warehouse';
  107. import { _closeModal } from '@/common/setup/modal/modal';
  108. export default defineComponent({
  109. name: 'purchase_pending_storage',
  110. emits: ['cancel', 'update'],
  111. components: {},
  112. props: {
  113. selectedRow: {
  114. type: Object as PropType<Ermcp3SellBuyContract>,
  115. default: {},
  116. },
  117. },
  118. setup(props, context) {
  119. const { visible, cancel } = _closeModal(context);
  120. const { rules, formState, formRef } = handleForm();
  121. const loading = ref<boolean>(false);
  122. const wareHouseList = ref<ErmcpWareHouseInfo[]>([]);
  123. const gblist = ref<[]>([]);
  124. const gmlist = ref<[]>([]);
  125. const DGList = ref<Ermcp3AreaStockApplySum[]>([]);
  126. QueryAreaStockApply(props.selectedRow.spotcontractid)
  127. .then((res) => {
  128. DGList.value = res.filter((e) => e.inouttype === 5);
  129. })
  130. .catch((err) => message.error(err));
  131. const deliverygoods = APP.get('DeliveryGoodsList').find((x: any) => x.data.deliverygoodsid === props.selectedRow.deliverygoodsid);
  132. gblist.value = deliverygoods && deliverygoods.gblist;
  133. gmlist.value = deliverygoods && deliverygoods.gmlist;
  134. // 查询仓库信息
  135. QueryWareHouse('1').then((res) => {
  136. wareHouseList.value = res;
  137. });
  138. function submit() {
  139. const wrapEl = unref(formRef);
  140. wrapEl.validate().then(() => {
  141. const params: ERMCPAreaInOutStockApplyReq = {
  142. InOutType: 5, // 5:采购入库 6:销售出库 7:生产入库 8:生产出库
  143. WRStandardID: props.selectedRow.wrstandardid, //品类ID
  144. SpotGoodsBrandID: formState.SpotGoodsBrandID || 0, //现货品牌ID(DGFactoryItem表的ID)
  145. DeliveryGoodsID: props.selectedRow.deliverygoodsid, //现货商品ID
  146. SpotContractID: Long.fromString(props.selectedRow.spotcontractid), //合同ID
  147. WarehouseInfo: formState.WarehouseInfo || 0, // uint64 现货仓库ID
  148. Qty: formState.Qty || 0, // double 数量t
  149. ApplyRemark: '', // string 申请备注
  150. };
  151. requestResultLoadingAndInfo(ermcpInOutStockApplyReq, params, loading, ['入库登记成功', '入库登记失败:']).then(() => {
  152. cancel(true);
  153. });
  154. });
  155. }
  156. return {
  157. visible,
  158. cancel,
  159. submit,
  160. loading,
  161. formatValue,
  162. rules,
  163. formState,
  164. formRef,
  165. wareHouseList,
  166. gblist,
  167. gmlist,
  168. DGList,
  169. };
  170. },
  171. });
  172. </script>
  173. <style lang="less">
  174. </style>;