Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

Z před 2 roky
rodič
revize
6400b5ab83

+ 1 - 1
package.json

@@ -36,7 +36,7 @@
     "highlight.js": "9.18.5",
     "jsbarcode": "^3.11.5",
     "json-bigint": "^1.0.0",
-    "mathjs": "11.11.0",
+    "mathjs": "^12.4.1",
     "nprogress": "^0.2.0",
     "tinymce": "^5.10.5",
     "vue": "^2.7.10",

+ 110 - 0
src/api/bpm/components/outsourcedWarehousing/index.js

@@ -0,0 +1,110 @@
+import request from '@/utils/request';
+
+/**
+ * 列表
+ */
+export async function getList (data) {
+  const res = await request.post('/aps/batchingplan/page', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 保存
+ */
+export async function save (data) {
+  const res = await request.post('/aps/batchingplan/save', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 修改
+ */
+export async function del (data) {
+  const res = await request.delete('/aps/batchingplan/delete', { data });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 发布信息返显  /
+ */
+export async function getById (id) {
+  const res = await request.get(`/mes/applyoutsource/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 详情
+ */
+export async function getPlanInfoById (id) {
+  const res = await request.get(`/aps/batchingplan/getPlanInfoById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+/**
+ * 发布信息返显
+ */
+export async function getReleaseInfoById (id) {
+  const res = await request.get(`/aps/batchingplan/getReleaseInfoById/${id}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 获取列表
+export async function getMaterialList(data) {
+  const res = await request.get(`/wms/outin/getRealTimeInventory`, {
+    params: data
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+
+
+
+// 批量根据生产计划计算bom列表信息
+
+export async function listBomBySalesOrderIds(data) {
+  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderIds`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+// 根据销售订单计算bom列表信息
+export async function listBomBySalesOrderId(data) {
+  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderId`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 提交
+export async function submit(data) {
+  const res = await request.post(`/bpm/apspurchaseplan/submit`,data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 7 - 1
src/views/bpm/handleTask/components/materialPlan/detailDialog.vue

@@ -47,6 +47,12 @@
                 </el-link>
               </template>
 
+              
+
+
+
+
+
 
               <template v-slot:imgUrl="{ row }">
                 <div v-if="row.imgUrl && row.imgUrl?.length">
@@ -132,7 +138,7 @@ export default {
           showOverflowTooltip: true
         },
         {
-          prop: 'deliveryNum',
+          prop: 'serialNo',
           label: '客户代号',
           align: 'center',
           showOverflowTooltip: true

+ 192 - 0
src/views/bpm/handleTask/components/outsourcedWarehousing/detailDialog.vue

@@ -0,0 +1,192 @@
+<template>
+  <div>
+
+    <headerTitle title="委外入库申请单"></headerTitle>
+
+
+
+      <ele-pro-table ref="table" :needPage="false" :columns="columns" row-key="id">
+ 
+      </ele-pro-table>
+
+
+
+  </div>
+</template>
+  
+<script>
+import { getById } from '@/api/bpm/components/outsourcedWarehousing/index';
+import { getFile } from '@/api/system/file';
+
+export default {
+  components: {
+
+  },
+  props: {
+    businessId: {
+      default: ''
+    }
+  },
+  mixins: [],
+
+  data() {
+    return {
+      visible: false,
+      title: '采购配料计划',
+
+      // 表格列配置
+      columns: [
+    
+      {
+                    columnKey: 'index',
+                    label: '序号',
+                    type: 'index',
+                    width: 55,
+                    align: 'center',
+                    showOverflowTooltip: true,
+                    fixed: 'left'
+                },
+                {
+                    prop: 'id',
+                    label: '委外单id',
+                    align: 'center',
+                    minWidth: 110
+                },
+
+                {
+                    prop: 'code',
+                    label: '委外编码',
+                    align: 'center'
+                },
+                {
+                    prop: 'name',
+                    label: '委外名称',
+                    align: 'center'
+                },
+
+                {
+                    prop: 'workOrderId',
+                    label: '工单id',
+                    align: 'center'
+                },
+
+
+                {
+                    prop: 'workOrderCode',
+                    label: '工单编码',
+                    align: 'center'
+                },
+                {
+                    prop: 'formedNumLast',
+                    label: '委外数量',
+                    align: 'center'
+                },
+
+                {
+                    prop: 'formedWeightLast',
+                    label: '委外重量',
+                    align: 'center'
+                },
+
+                {
+                    prop: 'totalWeight',
+                    label: '总重量',
+                    align: 'center'
+                },
+
+                
+                {
+                    prop: 'warehouseName',
+                    label: '入库仓库',
+                    align: 'center'
+                },
+
+
+                {
+                    prop: 'remark',
+                    label: '备注',
+                    align: 'center'
+                },
+
+                {
+                    prop: 'expectReceiveDate',
+                    label: '预计到货日期',
+                    align: 'center',
+                    showOverflowTooltip: true,
+                    minWidth: 110
+                },
+
+
+                {
+                    prop: 'createTime',
+                    label: '创建时间',
+                    align: 'center',
+                    showOverflowTooltip: true,
+                    minWidth: 110
+                },
+
+
+                
+                {
+                    columnKey: 'action',
+                    label: '操作',
+                    width: 120,
+                    align: 'center',
+                    resizable: false,
+                    fixed: 'right',
+                    slot: 'action',
+                    showOverflowTooltip: true
+                }
+
+
+      ],
+
+
+      rules: {},
+
+      formData: {
+        name: '',
+        remark: '',
+        detailRemoveIds: [],
+        materialRemoveIds: []
+      }
+    };
+  },
+  created() {
+    this.getDetailData(this.businessId);
+  },
+  methods: {
+
+    async getDetailData(id) {
+      this.loading = true;
+      const res = await getById(id);
+      console.log(33,res)
+      this.loading = false;
+      if (res) {
+        this.$set(this.formData, 'name', res.name);
+        this.$set(this.formData, 'remark', res.remark);
+        this.formData['id'] = res.id;
+        this.$refs.table.setData([...res.salesOrderList]);
+        this.$nextTick(() => {
+          this.$refs.table.toggleRowExpansionAll()
+          this.$forceUpdate()
+        })
+      }
+    },
+
+    handleMethod(row) {
+      this.$refs.timeDialogRef.open(row)
+    },
+  }
+};
+</script>
+  
+<style lang="scss" scoped>
+:deep(.el-table__expanded-cell) {
+
+  padding-bottom: 30px !important;
+  border-bottom: 12px solid #CCFFCC !important;
+}
+</style>
+
+

+ 169 - 0
src/views/bpm/handleTask/components/outsourcedWarehousing/submit.vue

@@ -0,0 +1,169 @@
+<template>
+  <el-col :span="16" :offset="6">
+    <el-form label-width="100px" ref="formRef" :model="form">
+      <el-form-item label="采购员" prop="technicianId" style="margin-bottom: 20px" :rules="{
+        required: true,
+        message: '请选择',
+        trigger: 'change'
+      }">
+        <el-select v-model="form.technicianId" clearable style="width: 100%" :filterable="true">
+          <el-option v-for="item in userOptions" @click.native="form.userName = item.name" :key="item.id"
+            :label="item.name" :value="item.id" />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="审批建议" prop="reason" style="margin-bottom: 20px" :rules="{
+        required: true,
+        message: '请选择',
+        trigger: 'change'
+      }">
+        <el-input type="textarea" v-model="form.reason" placeholder="请输入审批建议" />
+      </el-form-item>
+    </el-form>
+    <div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px">
+      <el-button icon="el-icon-edit-outline" type="success" size="mini" @click="handleAudit(1)">通过
+      </el-button>
+
+      <el-button icon="el-icon-circle-close" type="danger" size="mini" @click="handleAudit(0)">驳回
+      </el-button>
+
+      <el-dropdown @command="(command) => handleCommand(command)" style="margin-left: 30px;">
+        <span class="el-dropdown-link">更多<i class="el-icon-arrow-down el-icon--right"></i></span>
+        <el-dropdown-menu slot="dropdown">
+          <el-dropdown-item command="cancel">作废</el-dropdown-item>
+        </el-dropdown-menu>
+      </el-dropdown>
+
+
+    </div>
+
+  </el-col>
+</template>
+
+<script>
+
+import { apspurchaseplan, cancel } from '@/api/bpm/components/apsMeterialPlan';
+import { approveTaskWithVariables } from '@/api/bpm/task';
+import { listAllUserBind } from '@/api/system/organization';
+
+// 流程实例的详情页,可用于审批
+export default {
+  name: '',
+  components: {
+
+  },
+  props: {
+    businessId: {
+      default: ''
+    },
+    taskId: {
+      default: ''
+    },
+    id: {
+      default: ''
+    },
+
+    taskDefinitionKey: {
+      default: ''
+    }
+  },
+  data() {
+    return {
+      form: {
+        technicianId: '',
+        reason: ''
+      },
+      userOptions: []
+    };
+  },
+  created() {
+    this.userOptions = [];
+    listAllUserBind().then((data) => {
+      this.userOptions.push(...data);
+    });
+  },
+  methods: {
+
+
+    async handleAudit(status, type) {
+      //生产主管审批选择技术员
+
+      if (!this.form.technicianId && status == 1) {
+        this.$message.warning(`请选择采购员!`);
+        return;
+      }
+
+
+      this._approveTaskWithVariables(status);
+    },
+    async _approveTaskWithVariables(status) {
+
+
+      if (status == 1) {
+
+        apspurchaseplan({
+          businessId: this.businessId,
+          id: this.taskId,
+          userId: this.form.technicianId,
+          userName: this.form.userName,
+          reason: this.form.reason,
+          pass: true
+
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: ''
+            });
+          }
+        });
+      } else if (status == 0) {
+        approveTaskWithVariables({
+          id: this.taskId,
+          reason: this.form.reason,
+          pass: false
+        }).then((res) => {
+          if (res.data.code != '-1') {
+            this.$emit('handleAudit', {
+              status,
+              title: '驳回'
+            });
+          }
+        });
+      }
+
+    },
+
+    getTableValue() {
+      return new Promise((resolve, reject) => {
+        this.$emit('getTableValue', async (data) => {
+          resolve(await data);
+        });
+      });
+    },
+
+    //更多
+    handleCommand(command) {
+      if (command === 'cancel') {
+        this.$confirm("是否确认作废?", {
+          type: 'warning',
+          cancelButtonText: '取消',
+          confirmButtonText: '确定'
+        }).then(() => {
+          cancel({
+            id: this.taskId,
+            reason: this.form.reason,
+            businessId: this.businessId,
+          }).then(() => {
+            this.$emit('handleClose');
+          }).catch(() => {
+            this.$message.error("流程作废失败");
+          });
+        }).catch(() => {});
+      }
+    },
+
+  }
+};
+</script>
+
+<style lang="scss"></style>

+ 218 - 153
src/views/bpm/handleTask/components/productionWarehousing/productionWarehousing.vue

@@ -234,12 +234,12 @@
               </el-table-column>
               <el-table-column label="批号" width="100" prop="assetName">
                 <template slot-scope="{ row, $index }">
-                  <template v-if="row.isSave">
+                  <template>
                     {{ row.manualBatchNo }}
                   </template>
-                  <el-form-item v-else>
+                  <!-- <el-form-item>
                     <el-input v-model="row.manualBatchNo"> </el-input>
-                  </el-form-item>
+                  </el-form-item> -->
                 </template>
               </el-table-column>
               <el-table-column
@@ -271,7 +271,10 @@
               >
                 <el-table-column label="" prop="minPackingCount" width="100">
                   <template slot-scope="{ row, $index }">
-                    <template v-if="row.isSave">
+                    <template>
+                      {{ row.minPackingCount }}
+                    </template>
+                    <!-- <template v-if="row.isSave">
                       {{ row.minPackingCount }}
                     </template>
                     <el-form-item
@@ -285,7 +288,7 @@
                         @input="minPackingCountChange(row, $event)"
                       >
                       </el-input>
-                    </el-form-item>
+                    </el-form-item> -->
                   </template>
                 </el-table-column>
                 <el-table-column label="" prop="minPackingCount">
@@ -301,7 +304,10 @@
                 align="center"
               >
                 <template slot-scope="{ row, $index }">
-                  <template v-if="row.isSave || formData.bizType == 5">
+                  <template>
+                    {{ row.outInNum }} {{ row.minPackUnit }}
+                  </template>
+                  <!-- <template v-if="row.isSave || formData.bizType == 5">
                     {{ row.outInNum }} {{ row.minPackUnit }}
                   </template>
                   <el-form-item
@@ -317,7 +323,7 @@
                         {{ row.minPackUnit ? row.minPackUnit : '/' }}
                       </template>
                     </el-input>
-                  </el-form-item>
+                  </el-form-item> -->
                 </template>
               </el-table-column>
               <el-table-column label="计量数量" prop="counts">
@@ -370,7 +376,11 @@
                 align="center"
               >
                 <template slot-scope="{ row, $index }">
+                  <div v-if="row.isSave"
+                    >{{ row.univalence }}元/{{ handleRowUnit(row) }}</div
+                  >
                   <el-form-item
+                    v-else
                     :prop="`warehousingMaterialList.${$index}.univalence`"
                   >
                     <el-input
@@ -469,6 +479,7 @@
                     @click="listSave(row, $index)"
                     >保存</el-button
                   >
+
                   <el-button
                     type="text"
                     v-show="row.isSave"
@@ -500,7 +511,7 @@
                 </el-switch>
               </span>
 
-              <el-button
+              <!-- <el-button
                 style="margin-left: 20px"
                 type="text"
                 @click="dateSetting"
@@ -508,10 +519,10 @@
                 >批量设置{{
                   curDateType === 'manufactureTime' ? '生产日期' : '采购日期'
                 }}</el-button
-              >
+              > -->
             </div>
           </header-title>
-          <el-button
+          <!-- <el-button
             v-if="materialCodeReqList.length != 0"
             type="success"
             plain
@@ -519,7 +530,7 @@
             size="mini"
             @click="wrapListSave"
             >批量保存</el-button
-          >
+          > -->
           <el-table
             ref="materialCodeReqListTable"
             :data="materialCodeReqList"
@@ -563,6 +574,12 @@
               prop="batchNo"
               width="70"
             ></el-table-column>
+            <el-table-column
+              label="发货条码"
+              prop="barcodes"
+              width="80"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
             <el-table-column
               :label="`包装编码`"
               prop="onlyCode"
@@ -588,36 +605,22 @@
             ></el-table-column>
             <el-table-column label="物料代号" prop="materielCode" width="130">
               <template slot-scope="{ row }">
-                <el-input
-                  v-if="!row.isPack"
-                  v-model="row.materielCode"
-                ></el-input>
-                <span v-else>{{ row.materielCode }}</span>
+                <span>{{ row.materielCode }}</span>
               </template>
             </el-table-column>
             <el-table-column label="客户代号" prop="clientCode">
               <template slot-scope="{ row }">
-                <el-input
-                  v-if="!row.isPack"
-                  v-model="row.clientCode"
-                ></el-input>
-                <span v-else> {{ row.clientCode }}</span>
+                <span> {{ row.clientCode }}</span>
               </template>
             </el-table-column>
             <el-table-column label="刻码" prop="engrave">
               <template slot-scope="{ row }">
-                <el-input v-if="!row.isPack" v-model="row.engrave"></el-input>
-                <span v-else>{{ row.engrave }}</span>
+                <span>{{ row.engrave }}</span>
               </template>
             </el-table-column>
             <el-table-column label="重量" prop="weight" width="100">
               <template slot-scope="{ row }">
-                <el-input
-                  v-if="!row.isPack && row.measuringUnit != row.weightUtil"
-                  v-model="row.weight"
-                  @input="weightInput($event, row)"
-                ></el-input>
-                <span v-else>{{ row.weight }}</span>
+                <span>{{ row.weight }}</span>
               </template>
             </el-table-column>
             <el-table-column label="重量单位" prop="weightUtil">
@@ -628,14 +631,7 @@
 
             <el-table-column label="质检结果" prop="result" width="120">
               <template slot-scope="{ row }">
-                <DictSelection
-                  dictName="质检结果"
-                  clearable
-                  v-model="row.result"
-                  v-if="!row.isPack"
-                  @updateVal="changeWrapStatus($event, row)"
-                />
-                <span v-else>{{ qualityResults[row.result] }}</span>
+                <span>{{ qualityResults[row.result] }}</span>
               </template>
             </el-table-column>
             <el-table-column label="质检状态" prop="status" width="120">
@@ -643,67 +639,25 @@
                 <span>{{ qualityStatus[row.status] }}</span>
               </template>
             </el-table-column>
-
             <el-table-column
-              v-if="formData.bizType != 5"
               label="生产日期"
-              prop=""
-              width="220"
-            >
-              <template slot="header" slot-scope="scope">
-                <el-select filterable v-model="curDateType">
-                  <el-option
-                    value="manufactureTime"
-                    label="生产日期"
-                  ></el-option>
-                  <el-option
-                    value="procurementTime"
-                    label="采购日期"
-                  ></el-option>
-                </el-select>
-              </template>
-              <template slot-scope="{ row }">
-                <template v-if="formData.bizType == 5">
-                  {{ row[curDateType] }}
-                </template>
-                <el-date-picker
-                  v-else
-                  :disabled="row.ispack"
-                  size="small"
-                  v-model="row[curDateType]"
-                  type="datetime"
-                  value-format="yyyy-MM-dd HH:mm:ss"
-                  placeholder="选择日期"
-                >
-                </el-date-picker>
-              </template>
-            </el-table-column>
-            <template v-else>
-              <el-table-column
-                label="生产日期"
-                prop="manufactureTime"
-                width="200"
-              ></el-table-column>
-              <el-table-column
-                label="采购日期"
-                prop="procurementTime"
-                width="200"
-              ></el-table-column>
-            </template>
-            <el-table-column label="操作" width="80" fixed="right">
+              width="150"
+              prop="createTime"
+            ></el-table-column>
+            <!-- <el-table-column label="操作" width="80" fixed="right">
               <template slot-scope="{ row }">
                 <el-button type="text" @click="packCout(row)">
                   {{ !row.isPack ? '保存' : '编辑' }}
                 </el-button>
               </template>
-            </el-table-column>
+            </el-table-column> -->
           </el-table>
           <!-- </el-tab-pane>
         </el-tabs> -->
         </div>
         <div class="mt20" v-if="isSplit">
           <header-title :title="`物料明细`"> </header-title>
-          <el-button
+          <!-- <el-button
             v-if="resultArray.length != 0"
             type="success"
             plain
@@ -711,7 +665,8 @@
             size="mini"
             @click="materialListSave"
             >批量保存</el-button
-          >
+          > -->
+
           <el-table
             ref="resultArrayTable"
             :data="resultArray"
@@ -752,6 +707,12 @@
               width="200"
               :show-overflow-tooltip="true"
             ></el-table-column>
+            <el-table-column
+              label="发货条码"
+              prop="barcodes"
+              width="80"
+              :show-overflow-tooltip="true"
+            ></el-table-column>
             <el-table-column
               label="计量数量"
               prop="minPackingCount"
@@ -764,49 +725,29 @@
             ></el-table-column>
             <el-table-column label="物料代号" prop="meterielCode" width="130">
               <template slot-scope="{ row }">
-                <el-input
-                  v-model="row.materielCode"
-                  v-if="!row.isPack"
-                ></el-input>
-                <span v-else>{{ row.materialCode }}</span>
+                <span>{{ row.materialCode }}</span>
               </template>
             </el-table-column>
             <el-table-column label="客户代号" prop="clientCode">
               <template slot-scope="{ row }">
-                <el-input
-                  v-model="row.clientCode"
-                  v-if="!row.isPack"
-                ></el-input>
-                <span v-else> {{ row.clientCode }}</span>
+                <span> {{ row.clientCode }}</span>
               </template>
             </el-table-column>
             <el-table-column label="刻码" prop="engrave">
               <template slot-scope="{ row }">
-                <el-input v-model="row.engrave" v-if="!row.isPack"></el-input>
-                <span v-else> {{ row.engrave }}</span>
+                <span> {{ row.engrave }}</span>
               </template>
             </el-table-column>
             <el-table-column width="100" label="重量" prop="weight">
               <template slot-scope="{ row }">
-                <el-input
-                  v-model="row.weight"
-                  v-if="!row.isPack && row.measuringUnit != row.weightUnit"
-                ></el-input>
-                <span v-else>{{ row.weight }}</span>
+                <span>{{ row.weight }}</span>
               </template>
             </el-table-column>
             <el-table-column label="重量单位" prop="weightUnit" width="100">
             </el-table-column>
             <el-table-column label="质检结果" prop="result" width="120">
               <template slot-scope="{ row }">
-                <DictSelection
-                  dictName="质检结果"
-                  clearable
-                  v-model="row.result"
-                  v-if="!row.isPack"
-                  @updateVal="changeWrapStatus($event, row)"
-                />
-                <span v-else>{{ qualityResults[row.result] }}</span>
+                <span>{{ qualityResults[row.result] }}</span>
               </template>
             </el-table-column>
             <el-table-column label="质检状态" prop="status" width="120">
@@ -814,13 +755,13 @@
                 <span>{{ qualityStatus[row.status] }}</span>
               </template>
             </el-table-column>
-            <el-table-column label="操作" width="80" fixed="right">
+            <!-- <el-table-column label="操作" width="80" fixed="right">
               <template slot-scope="{ row }">
                 <el-button type="text" @click="materialBtn(row)">
                   {{ !row.isPack ? '保存' : '编辑' }}
                 </el-button>
               </template>
-            </el-table-column>
+            </el-table-column> -->
           </el-table>
         </div>
       </div>
@@ -878,6 +819,7 @@
   import { tableHeader } from '@/views/bpm/handleTask/components/inoutBound/common';
   import { getCode } from '@/api/codeManagement/index.js';
   import { getReceiveSaleOrderrecordDetail } from '@/api/bpm/components/purchasingManage/purchaseorderreceive';
+  import { deepClone } from 'ele-admin/lib/utils/core';
 
   export default {
     components: {
@@ -1026,6 +968,7 @@
                 no: item.onlyCode + i.toString().padStart(4, '0'),
                 assetCode: item.assetCode,
                 assetName: item.assetName,
+                barcodes: item.barcodes,
                 manualBatchNo: item.manualBatchNo,
                 batchNo: item.batchNo,
                 minPackingCount: 1,
@@ -1302,6 +1245,7 @@
         // this.formData.extInfo.supplierName = row.supplierName;
         // this.formData.extInfo.supplierId = row.supplierId;
         if (this.warehousingMaterialList.length == 0) {
+          this.createDataByWrap(row);
           // let list = data.productList.map((item) => {
           //   return {
           //     ...item,
@@ -1311,17 +1255,138 @@
           //     minPackUnit: item.packingUnit
           //   };
           // });
-          this.onSelectTableData(
-            await this.serachMainCode({
-              ...row,
-              assetName: row.categoryName,
-              assetCode: row.categoryCode,
-              categoryId: row.categoryId,
-              minPackUnit: row.packingUnit
-            })
-          );
+          // this.onSelectTableData(
+          //   await this.serachMainCode({
+          //     ...row,
+          //     assetName: row.categoryName,
+          //     assetCode: row.categoryCode,
+          //     categoryId: row.categoryId,
+          //     minPackUnit: row.packingUnit
+          //   })
+          // );
         }
       },
+      async createDataByWrap(wrapData) {
+        console.log(wrapData);
+        let list = deepClone(wrapData);
+        const batchNo = await getCode('lot_number_code'); // 生成批次号
+        let sameItemWraplist = []; // 储存分类数据
+        let sameItemWrapInfolist = []; // 用来判断去重
+        // 先过滤同一种物品下面包装
+        list.detailList.forEach((item) => {
+          if (sameItemWraplist.length > 0) {
+            let filterArr = sameItemWrapInfolist.filter(
+              (it) =>
+                item.categoryCode == it.categoryCode &&
+                item.quantity == it.quantity
+            );
+            if (filterArr.length > 0) {
+              sameItemWraplist[filterArr[0].index].push(item);
+            } else {
+              sameItemWraplist.push([item]);
+              sameItemWrapInfolist.push({
+                categoryCode: item.categoryCode,
+                quantity: item.quantity,
+                index: sameItemWrapInfolist.length
+              });
+            }
+          } else {
+            sameItemWraplist.push([item]);
+            sameItemWrapInfolist.push({
+              categoryCode: item.categoryCode,
+              quantity: item.quantity,
+              index: 0
+            });
+          }
+        });
+
+        // 添加包装批号丶包装编码丶包装数量
+        Promise.all(
+          sameItemWraplist.map(async (goodsItem) => {
+            const onlyCodeList = await outin.getAssetNum({
+              assetCode: goodsItem[0].categoryCode,
+              batchNum: batchNo,
+              num: goodsItem.length
+            });
+            goodsItem = goodsItem.map((wrapItem) => {
+              return {
+                ...wrapItem,
+                assetCode: wrapData.categoryCode,
+                assetName: wrapData.categoryName,
+                manualBatchNo: wrapData.manualBatchNo,
+                batchNo,
+                barcodes: wrapItem.sendCode,
+                weight: wrapItem.packingWeight,
+                initWeight: wrapItem.packingWeight,
+                weightUtil: wrapItem.weightUnit,
+                engrave: wrapItem.extInfo.engrave,
+                materielCode: wrapItem.extInfo.materielCode,
+                clientCode: wrapItem.extInfo.clientCode,
+                num: wrapItem.quantity,
+                isPack: false,
+                minPackingCount: wrapItem.quantity,
+                onlyCode: onlyCodeList.shift().onlyCode,
+                result: '0',
+                status: '1',
+                modelType: wrapData.modelType,
+                specification: wrapData.specification,
+                brandNum: wrapData.brandNum
+              };
+            });
+            console.log(goodsItem);
+            return goodsItem;
+          })
+        ).then((sameItemWraplist) => {
+          console.log(sameItemWraplist.flat());
+          console.log(sameItemWraplist);
+          console.log(sameItemWrapInfolist);
+          this.warehousingMaterialList = sameItemWraplist.map((goodsItem) => {
+            return {
+              assetCode: wrapData.categoryCode,
+              assetName: wrapData.categoryName,
+              manualBatchNo: wrapData.manualBatchNo,
+              modelType: wrapData.modelType,
+              specification: wrapData.specification,
+              brandNum: wrapData.brandNum,
+              batchNo,
+              categoryId: goodsItem[0].categoryId,
+              minPackingCount: goodsItem[0].num,
+              outInNum: goodsItem.length,
+              minPackUnit: goodsItem[0].packingUnit,
+              measuringUnit: goodsItem[0].measuringUnit,
+              weight: goodsItem.reduce((num, pre) => (num += pre.weight), 0),
+              weightUnit: goodsItem[0].weightUnit,
+              univalence: wrapData.univalence > 0 ? wrapData.univalence : '',
+              warehouseId: goodsItem[0].warehouseId,
+              houseList: [],
+              warehouseLedgerDetails: goodsItem
+            };
+          });
+        });
+        // this.materialCodeReqList = list.detailList.map((wrapItem) => {
+        //   return {
+        //     code: it.onlyCode,
+        //     dateType: 2, // 2生产日期 1采购日期
+        //     dateValue: wrapItem.createTime,
+        //     minUnit: it.minPackingCount,
+        //     minPositionId: it.cargoSpaceId,
+        //     minPackingCount: it.minPackingCount,
+        //     name: it.assetName,
+        //     pathIds: item.pathIds,
+        //     unit: it.unit,
+        //     packageNo: it.num,
+        //     clientCode: it.clientCode,
+        //     materielCode: it.materielCode,
+        //     weight: it.weight,
+        //     weightUtil: it.weightUtil,
+        //     engrave: it.engrave,
+        //     materialDetails: this.materialDetails(it.onlyCode),
+        //     packingCount: it.packingCount,
+        //     status: it.status,
+        //     result: it.result
+        //   };
+        // });
+      },
       async serachMainCode(arr) {
         let newArr = [];
         const data = await getProductList({
@@ -1395,19 +1460,19 @@
       },
       // 仓库编辑
       handleWareHouse(row, idx) {
-        this.$refs.wareHouseDailogRef.open(row, idx);
+        this.$refs.wareHouseDailogRef.open(row, idx, true);
       },
       // 入库操作
       listEdit(row) {
         this.$set(row, 'isSave', false);
-        row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
-        row.warehouseLedgerDetails = [];
-        // 重置重量
-        this.packNum(row, row.outInNum);
-        // 清空物料明细防止数据错乱
-        if (this.isSplit && this.resultArray?.length > 0) {
-          this.handleIsDetail(false);
-        }
+        // row.selfWarehouseLedgerDetails = row.warehouseLedgerDetails;
+        // row.warehouseLedgerDetails = [];
+        // // 重置重量
+        // this.packNum(row, row.outInNum);
+        // // 清空物料明细防止数据错乱
+        // if (this.isSplit && this.resultArray?.length > 0) {
+        //   this.handleIsDetail(false);
+        // }
       },
       // 产品单个保存
       listSave(row, index) {
@@ -1417,7 +1482,7 @@
         }
         const fileds = [
           // `warehousingMaterialList.${index}.cargoSpaceCode`,
-          `warehousingMaterialList.${index}.batchNo`,
+          // `warehousingMaterialList.${index}.batchNo`,
           `warehousingMaterialList.${index}.houseList`
         ];
         if (this.formData.bizType == 1) {
@@ -1426,12 +1491,12 @@
           // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
         }
         if (this.formData.bizType != 5) {
-          fileds.push(
-            ...[
-              `warehousingMaterialList.${index}.outInNum`,
-              `warehousingMaterialList.${index}.minPackingCount`
-            ]
-          );
+          // fileds.push(
+          //   ...[
+          //     `warehousingMaterialList.${index}.outInNum`,
+          //     `warehousingMaterialList.${index}.minPackingCount`
+          //   ]
+          // );
         } else if (
           this.warehousingMaterialList.some(
             (i) => !i.selfWarehouseLedgerDetails?.length
@@ -1458,8 +1523,9 @@
           )
         )
           .then((res) => {
+            console.log('-------------');
             this.$set(row, 'isSave', true);
-            this.createMaterialCode(row);
+            // this.createMaterialCode(row);
           })
           .catch((err) => {
             this.$message.error('请填入必填项!');
@@ -1481,7 +1547,7 @@
           const index = indexes[i];
           const fileds = [
             // `warehousingMaterialList.${index}.cargoSpaceCode`,
-            `warehousingMaterialList.${index}.batchNo`,
+            // `warehousingMaterialList.${index}.batchNo`,
             `warehousingMaterialList.${index}.houseList`
           ];
           if (this.formData.bizType == 1) {
@@ -1490,12 +1556,12 @@
             // fileds.push(...[`warehousingMaterialList.${index}.supplierCode`]);
           }
           if (this.formData.bizType != 5) {
-            fileds.push(
-              ...[
-                `warehousingMaterialList.${index}.outInNum`,
-                `warehousingMaterialList.${index}.minPackingCount`
-              ]
-            );
+            // fileds.push(
+            //   ...[
+            //     `warehousingMaterialList.${index}.outInNum`,
+            //     `warehousingMaterialList.${index}.minPackingCount`
+            //   ]
+            // );
           } else if (
             this.warehousingMaterialList.some(
               (i) => !i.selfWarehouseLedgerDetails?.length
@@ -1523,7 +1589,7 @@
           )
             .then((res) => {
               this.$set(row, 'isSave', true);
-              this.createMaterialCode(row);
+              // this.createMaterialCode(row);
             })
             .catch((err) => {
               if (showMessage) {
@@ -1583,6 +1649,7 @@
           batchNum: row.batchNo,
           num: num
         });
+
         // row.measuringUnit == 'PCS' ? nums :
 
         list.forEach((item) => {
@@ -1747,12 +1814,7 @@
                   num: item.num > 0 ? item.num : 0,
                   manualBatchNo: item.manualBatchNo,
                   batchNo: item.batchNo,
-                  categoryId:
-                    this.formData.bizType == 2
-                      ? item.categoryId
-                        ? item.categoryId
-                        : item.id
-                      : item.id,
+                  categoryId: item.categoryId,
                   count:
                     item.outInNum > 0 && item.minPackingCount > 0
                       ? this.$math.format(
@@ -1766,6 +1828,7 @@
                   packingCount: item.outInNum > 0 ? item.outInNum : 0,
                   price: item.univalence > 0 ? item.univalence : 0,
                   outInDetailRecordAddPOList: item.warehouseLedgerDetails,
+                  manualBatchNo: item.manualBatchNo,
                   position: `${item.warehouseName}-${item.areaName}-${item.shelfCode}-${item.cargoSpaceCode}`,
                   remark: '',
                   pathIds: `${item.warehouseId},${item.areaId},${item.shelfId},${item.cargoSpaceId}`,
@@ -1837,6 +1900,8 @@
           name: it.assetName,
           pathIds: item.pathIds,
           unit: it.unit,
+          barcodes: it.barcodes,
+          manualBatchNo: it.manualBatchNo,
           packageNo: it.num,
           clientCode: it.clientCode,
           materielCode: it.materielCode,

+ 1 - 1
src/views/bpm/handleTask/components/productionWarehousing/submit.vue

@@ -69,9 +69,9 @@
       async storeManagerApprove() {
         let res = await this.getTableValue();
         let storageData = res.returnStorageData;
-        console.log(storageData);
         // 入库来源storageSource 0-正常  1-外部(外部跳过内部审核流程)
         storageData.storageSource = 1;
+        console.log(storageData);
         try {
           this.isSaveLoading = true;
           await outin.save(storageData);

+ 81 - 50
src/views/bpm/stockManagement/components/WareHouseDailog.vue

@@ -227,10 +227,11 @@
         this.locationList = res;
       },
       getStatus: useDict(warehouseDefinition_locationStatus),
-      async open(row, idx) {
+      async open(row, idx, boolen) {
+        console.log(row);
         this.locationList = [];
         this.tableList = [];
-        if (row.houseList.length != 0) {
+        if (boolen) {
           this.row = row;
           this.idx = idx;
           this.visible = true;
@@ -240,6 +241,8 @@
             this.formData.warehouse = this.warehouseList.find(
               (w) => w.id == this.row.warehouseId
             );
+            console.log('this.warehouse-----', this.warehouse);
+            console.log('this.formData.warehouse---', this.formData.warehouse);
             const res = await warehouseDefinition.getById({
               id: this.row.warehouseId
             });
@@ -249,57 +252,84 @@
               this.row.warehouseId
             );
             this.areaList = rep || [];
-            console.log('===', rep);
-            //
+          }
+        } else {
+          if (row.houseList.length != 0) {
+            this.row = row;
+            this.idx = idx;
+            this.visible = true;
+            await this._getWarehouseChildren();
+            if (this.row?.warehouseId) {
+              this.warehouse = this.row.warehouseId;
+              this.formData.warehouse = this.warehouseList.find(
+                (w) => w.id == this.row.warehouseId
+              );
+              console.log('this.warehouse-----', this.warehouse);
+              console.log(
+                'this.formData.warehouse---',
+                this.formData.warehouse
+              );
+              const res = await warehouseDefinition.getById({
+                id: this.row.warehouseId
+              });
 
-            this.formData.area = this.areaList.find(
-              (w) => w.id == this.row.houseList[0].areaId
-            ); // this.row.areaId
-            this.area = this.row.houseList[0].areaId;
+              // this.areaList = res.reservoirAreaList || [];
+              const rep = await warehouseDefinition.getListByWarehouseId(
+                this.row.warehouseId
+              );
+              this.areaList = rep || [];
+              console.log('===', rep);
+              //
 
-            // ===============================
-            const result = await await warehouseDefinition.getListByAreaId(
-              this.row.houseList[0].areaId
-            );
-            this.areaGoodsshelvesList = result || [];
-            this.shelvesList = this.areaGoodsshelvesList.filter(
-              (i) => i.id === this.row.houseList[0].shelfId
-            );
-            this.formData.shelves = this.areaGoodsshelvesList.find(
-              (w) => w.id == this.row.houseList[0].shelfId
-            );
-            this.shelves = this.row.houseList[0].shelfCode;
-            // =========================
-            const loca = await warehouseDefinition.getListByGoodId(
-              this.row.houseList[0].shelfId
-            );
-            this.locationList = loca;
-            const items = loca.filter(
-              (item) => item.id == this.row.houseList[0].cargoSpaceId
-            );
-            this.handlCur(items[0], this.row.houseList[0].num);
-            console.log('items111', items);
-            // this.allocationReqList = res.goodsAllocationList || [];
-            // this.locationList = this.allocationReqList.filter(
-            //   (i) => i.goodsAllocationCode === this.shelves
-            // );
-            // this.cur = this.allocationReqList.find(
-            //   (w) => w.code === this.row.cargoSpaceCode
-            // );
+              this.formData.area = this.areaList.find(
+                (w) => w.id == this.row.houseList[0].areaId
+              ); // this.row.areaId
+              this.area = this.row.houseList[0].areaId;
+
+              // ===============================
+              const result = await await warehouseDefinition.getListByAreaId(
+                this.row.houseList[0].areaId
+              );
+              this.areaGoodsshelvesList = result || [];
+              this.shelvesList = this.areaGoodsshelvesList.filter(
+                (i) => i.id === this.row.houseList[0].shelfId
+              );
+              this.formData.shelves = this.areaGoodsshelvesList.find(
+                (w) => w.id == this.row.houseList[0].shelfId
+              );
+              this.shelves = this.row.houseList[0].shelfCode;
+              // =========================
+              const loca = await warehouseDefinition.getListByGoodId(
+                this.row.houseList[0].shelfId
+              );
+              this.locationList = loca;
+              const items = loca.filter(
+                (item) => item.id == this.row.houseList[0].cargoSpaceId
+              );
+              this.handlCur(items[0], this.row.houseList[0].num);
+              console.log('items111', items);
+              // this.allocationReqList = res.goodsAllocationList || [];
+              // this.locationList = this.allocationReqList.filter(
+              //   (i) => i.goodsAllocationCode === this.shelves
+              // );
+              // this.cur = this.allocationReqList.find(
+              //   (w) => w.code === this.row.cargoSpaceCode
+              // );
+            }
+          } else {
+            this.row = row;
+            this.idx = idx;
+            this.visible = true;
+            await this._getWarehouseChildren();
+            this.formData = {
+              warehouse: {},
+              area: {},
+              shelves: {}
+            };
+            this.warehouse = '';
+            this.area = '';
+            this.shelves = '';
           }
-        } else {
-          this.row = row;
-          this.idx = idx;
-          this.visible = true;
-          await this._getWarehouseChildren();
-          this.formData = {
-            warehouse: {},
-            area: {},
-            shelves: {}
-          };
-          this.warehouse = '';
-          this.area = '';
-          this.shelves = '';
         }
       },
       async changeWarehouse(val) {
@@ -379,6 +409,7 @@
         this.warehouseList = res.map((item) => {
           return { ...item, name: item.factoryName + '-' + item.name };
         });
+        console.log(this.warehouseList);
 
         // const res = await getWarehouseChildren();
         // if (res?.success) {

+ 1 - 0
src/views/bpm/todo/index.vue

@@ -234,6 +234,7 @@
       /** 处理审批按钮 */
 
       handleAudit(type, row) {
+      
         if (type == 'audit') {
           this.$refs.handleTaskRef.open({
             id: row.processInstance.id,