index.vue 9.1 KB

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