695593266@qq.com 11 месяцев назад
Родитель
Сommit
aefdc64508

+ 9 - 0
src/api/produce/job.js

@@ -55,3 +55,12 @@ export async function getTeam(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+//查询已报工的数量
+export async function checkReportNumber(data) {
+  const res = await request.post(`/pda/mes/workreport/reportCheck`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 2 - 2
src/views/InTheSystem/index.vue

@@ -43,7 +43,7 @@
     data() {
       return {
         loading: false,
-        tableHeight: 'calc(100vh - 330px)'
+        tableHeight: 'calc(100vh - 340px)'
       };
     },
     computed: {
@@ -181,7 +181,7 @@
         if (fullscreen) {
           this.tableHeight = 'calc(100vh - 120px)';
         } else {
-          this.tableHeight = 'calc(100vh - 330px)';
+          this.tableHeight = 'calc(100vh - 340px)';
         }
       },
 

+ 7 - 2
src/views/produce/components/feeding/components/batchProductsBom.vue

@@ -80,7 +80,9 @@
           <el-input v-model="form.batchNo"></el-input>
         </el-form-item>
         <el-form-item label="拆批数">
-          <el-input v-model="form.quantity" @input="batchInput"></el-input>
+          <el-input v-model="form.quantity" @input="batchInput">
+            {{ form.unit }}
+          </el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -119,7 +121,8 @@
         dialogVisible: false,
         form: {
           quantity: '',
-          batchNo: ''
+          batchNo: '',
+          unit: ''
         },
         itemData: {},
         itemIndex: '',
@@ -264,9 +267,11 @@
       openBatch(row, index) {
         this.form.quantity = '';
         this.form.batchNo = '';
+        this.form.unit = '';
         this.itemData = row;
         this.itemIndex = index;
         this.form.batchNo = row.batchNo;
+        this.form.unit = row.unit;
         this.dialogVisible = true;
       },
 

+ 1 - 1
src/views/produce/components/feeding/index.vue

@@ -594,7 +594,7 @@
       },
 
       openPicking(id, item) {
-        this.$refs.pickingListRef.open(id, item, '选择列表');
+        this.$refs.pickingListRef.open(id, item, '选择设备列表');
       },
 
       chooseData(listData) {

+ 21 - 4
src/views/produce/components/jobBooking/components/batchPackagingGrouping.vue

@@ -5,7 +5,18 @@
         >是否拆包:</div
       >
       <span
-        v-if="objData.isUnpack == '1' || isNewUnpack == 1"
+        v-if="objData.isUnpack == '1' && objData.singleReport == '1'"
+        style="
+          color: green;
+          font-size: 14px;
+          font-weight: 700;
+          margin-left: 15px;
+        "
+        >是</span
+      >
+
+      <span
+        v-if="isNewUnpack == '1' && objData.singleReport == '0'"
         style="
           color: green;
           font-size: 14px;
@@ -30,11 +41,17 @@
         size="mini"
         style="margin-left: 40px"
         @click="checkUnpack"
-        v-if="objData.isUnpack != '1'"
+        v-if="objData.singleReport == '0'"
         >手动拆包</el-button
       >
     </div>
-    <div v-if="objData.isUnpack == '1' && (isNewUnpack == 0 || !isNewUnpack)">
+    <div
+      v-if="
+        objData.isUnpack == '1' &&
+        (isNewUnpack == 0 || !isNewUnpack) &&
+        objData.singleReport == '1'
+      "
+    >
       <div class="col userInp" style="display: flex; align-items: center">
         <div class="label lable150 rx-cc" style="width: 100px !important"
           >规格选择:</div
@@ -515,7 +532,7 @@
           } else {
             this.formedNumLast = 0;
           }
-          if (newVal.isUnpack == '1') {
+          if (newVal.isUnpack == '1' && this.objData.singleReport == '1') {
             this.packageDispositionFn();
           }
 

+ 17 - 11
src/views/produce/components/jobBooking/components/batchSemiProductJobBom.vue

@@ -149,7 +149,9 @@
       </template>
 
       <template v-slot:packageQuantity="{ row, $index }">
-        <span>{{ row.packageQuantity }}{{ row.packingUnit }}</span>
+        <span v-if="row.packageQuantity"
+          >{{ row.packageQuantity }}{{ row.packingUnit }}</span
+        >
       </template>
 
       <template v-slot:position="{ row, $index }">
@@ -341,12 +343,7 @@
           type="text"
           style="color: orange"
           @click="openLoss(row, $index)"
-          v-if="
-            ![2, 3, 6].includes(Number(item.currentTaskDiagram.type)) &&
-            !row.extInfo.isLoss &&
-            item.currentTaskDiagram.isFirstTask != 1 &&
-            item.currentTaskDiagram.taskId != '-1'
-          "
+          v-if="!row.extInfo.isLoss && item.currentTaskDiagram.isFirstTask != 1"
           >损耗</el-link
         >
 
@@ -555,8 +552,9 @@
             v-model="batchForm.quantity"
             style="width: 220px"
             @input="batchInput"
-          ></el-input>
-          {{ batchForm.unit }}
+          >
+            <template slot="append"> {{ batchForm.unit }}</template>
+          </el-input>
         </el-form-item>
         <el-form-item label="是否合格">
           <el-select
@@ -659,8 +657,9 @@
             v-model="lossForm.quantity"
             style="width: 220px"
             @input="lossInput"
-          ></el-input>
-          {{ lossForm.unit }}
+          >
+            <template slot="append"> {{ lossForm.unit }}</template>
+          </el-input>
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -1311,6 +1310,8 @@
           );
         }
 
+        this.$forceUpdate();
+
         console.log(this.item.workReportInfo, 'this.item.workReportInfo');
       },
 
@@ -1605,6 +1606,11 @@
 
       async getLossParam() {
         if (this.lossForm.quantity) {
+          if (Number(this.lossData.feedQuantity) == 0) {
+            this.$message.warning('损耗数不能为0');
+            return;
+          }
+
           if (
             Number(this.lossData.feedQuantity) < Number(this.lossForm.quantity)
           ) {

+ 20 - 12
src/views/produce/components/jobBooking/details.vue

@@ -7,22 +7,20 @@
           <div class="item_box rx-bc">
             <div class="round">{{ index + 1 }}</div>
             <div class="time"
-              >报工时间:{{
+              >报工时间:<span v-if="objData.workReportInfo.executorStartTime">
+                {{ objData.workReportInfo.executorStartTime }}- </span
+              ><span>{{
                 objData.workReportInfo
                   ? objData.workReportInfo.executorTime
                   : ''
-              }}
-            </div>
-          </div>
-
-          <div class="item_box rx-bc">
-            <div class="time"
-              >报工人:{{
-                objData.workReportInfo
-                  ? objData.workReportInfo.executorName
-                  : ''
-              }}
+              }}</span>
+              <span
+                style="margin-left: 10px"
+                v-if="objData.workReportInfo.workTime"
+                >工时:{{ objData.workReportInfo.workTime }}小时</span
+              >
             </div>
+            <!-- <div v-if="objData.workReportInfo.executorStartTime"></div> -->
           </div>
 
           <div class="item_box rx-bc">
@@ -37,6 +35,16 @@
         </div>
 
         <div class="rx-bc">
+          <div class="item_box rx-bc">
+            <div class="time"
+              >报工人:{{
+                objData.workReportInfo
+                  ? objData.workReportInfo.executorName
+                  : ''
+              }}
+            </div>
+          </div>
+
           <div class="item_box rx-bc">
             <div
               class="time"

+ 391 - 91
src/views/produce/components/jobBooking/index.vue

@@ -5,17 +5,32 @@
         style="display: flex; align-items: center; margin-right: 10px"
         v-if="List.length > 1"
       >
-        <div class="rx-bc">
+        <div class="rx-bc" v-if="isReportTime">
           <div class="name">批量报工时间:</div>
+          <el-date-picker
+            v-model="reportTime"
+            type="datetimerange"
+            range-separator="至"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            align="right"
+            @change="changeBatchReportTime"
+          >
+          </el-date-picker>
+        </div>
+
+        <div class="rx-bc" v-if="!isReportTime">
+          <div class="name">批量报工时间:</div>
+          <el-date-picker
+            v-model="executorTime"
+            type="datetime"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            placeholder="选择日期"
+            @change="handleCreate"
+          >
+          </el-date-picker>
         </div>
-        <el-date-picker
-          v-model="executorTime"
-          type="datetime"
-          value-format="yyyy-MM-dd HH:mm:ss"
-          placeholder="选择日期"
-          @change="handleCreate"
-        >
-        </el-date-picker>
       </div>
 
       <el-button
@@ -81,52 +96,120 @@
           <div class="title_box rx-bc">
             <div class="name">报工时间</div>
           </div>
-          报工时间:
-          <el-date-picker
-            v-model="item.workReportInfo.executorTime"
-            type="datetime"
-            value-format="yyyy-MM-dd HH:mm:ss"
-            placeholder="选择日期"
-            style="margin-right: 25px; width: 190px"
-          >
-          </el-date-picker>
 
-          执行人:
-          <el-select
-            v-model="teamId"
-            placeholder="请选择班组"
-            filterable
-            style="width: 120px"
-            @change="checkTeamList(teamId)"
-          >
-            <el-option
-              v-for="item in teamList"
-              :label="item.name"
-              :value="item.id"
-              :key="item.id"
+          <div v-if="isReportTime">
+            报工时间
+            <el-date-picker
+              v-model="item.workReportInfo.reportTime"
+              type="datetimerange"
+              range-separator="至"
+              start-placeholder="开始时间"
+              end-placeholder="结束时间"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              align="right"
+              style="margin-right: 10px"
+              @change="changeReportTime(index)"
             >
-            </el-option>
-          </el-select>
-          <el-select
-            v-model="executorIdList"
-            placeholder="请选择执行人"
-            filterable
-            multiple
-            @change="changeId"
-          >
-            <div class="checkboxWrapper">
-              <el-checkbox v-model="checked" @change="checkChange">
-                全选
-              </el-checkbox>
+            </el-date-picker>
+
+            工时
+            <el-input
+              v-model="item.workReportInfo.workTime"
+              placeholder="请输入工时"
+              style="width: 220px"
+            >
+              <template slot="append">小时</template>
+            </el-input>
+
+            <div style="margin-top: 10px">
+              执行人:
+              <el-select
+                v-model="teamId"
+                placeholder="请选择班组"
+                filterable
+                style="width: 120px"
+                @change="checkTeamList(teamId)"
+              >
+                <el-option
+                  v-for="item in teamList"
+                  :label="item.name"
+                  :value="item.id"
+                  :key="item.id"
+                >
+                </el-option>
+              </el-select>
+              <el-select
+                v-model="executorIdList"
+                placeholder="请选择执行人"
+                filterable
+                multiple
+                @change="changeId(index)"
+                style="width: 160px"
+              >
+                <div class="checkboxWrapper">
+                  <el-checkbox v-model="checked" @change="checkChange(index)">
+                    全选
+                  </el-checkbox>
+                </div>
+                <el-option
+                  v-for="item in teamUserList"
+                  :label="item.name"
+                  :value="item.id"
+                  :key="item.id"
+                >
+                </el-option>
+              </el-select>
             </div>
-            <el-option
-              v-for="item in teamUserList"
-              :label="item.name"
-              :value="item.id"
-              :key="item.id"
+          </div>
+
+          <div v-else>
+            报工时间:
+            <el-date-picker
+              v-model="item.workReportInfo.executorTime"
+              type="datetime"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              placeholder="选择日期"
+              style="margin-right: 25px; width: 190px"
+            >
+            </el-date-picker>
+
+            执行人:
+            <el-select
+              v-model="teamId"
+              placeholder="请选择班组"
+              filterable
+              style="width: 120px"
+              @change="checkTeamList(teamId)"
+            >
+              <el-option
+                v-for="item in teamList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+            <el-select
+              v-model="executorIdList"
+              placeholder="请选择执行人"
+              filterable
+              multiple
+              @change="changeId(index)"
             >
-            </el-option>
-          </el-select>
+              <div class="checkboxWrapper">
+                <el-checkbox v-model="checked" @change="checkChange">
+                  全选
+                </el-checkbox>
+              </div>
+              <el-option
+                v-for="item in teamUserList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+          </div>
         </div>
 
         <paramBom
@@ -477,7 +560,7 @@
 </template>
 
 <script>
-  import { listByIdsReport } from '@/api/produce/job';
+  import { listByIdsReport, checkReportNumber } from '@/api/produce/job';
   import { getWarehouseList } from '@/api/produce/index';
   import {
     jobSave,
@@ -575,7 +658,10 @@
         teamUserList: [],
         executorIdList: [],
         teamId: '',
-        checked: false
+        checked: false,
+        isReportTime: false,
+        reportTime: '',
+        workHour: ''
       };
     },
 
@@ -627,7 +713,6 @@
       handleCreate(e) {
         if (e) {
           const list = JSON.parse(JSON.stringify(this.List));
-          console.log(list);
           list.map((item) => {
             item.workReportInfo.executorTime = e;
           });
@@ -635,6 +720,26 @@
         }
       },
 
+      changeBatchReportTime(e) {
+        if (e) {
+          const list = JSON.parse(JSON.stringify(this.List));
+          list.map((item) => {
+            item.workReportInfo.reportTime = e;
+            const startTime = new Date(item.workReportInfo.reportTime[0]);
+            const endTime = new Date(item.workReportInfo.reportTime[1]);
+
+            const diffMs = endTime - startTime;
+            const diffHours = diffMs / (1000 * 60 * 60);
+
+            if (this.executorIdList.length != 0) {
+              item.workReportInfo.workTime =
+                Number(diffHours) * Number(this.executorIdList.length);
+            }
+          });
+          this.$set(this, 'List', list);
+        }
+      },
+
       async getTeamList(id) {
         const ids = id.split(',');
         this.teamList = [];
@@ -654,6 +759,12 @@
       },
 
       async getChooseEngrave() {
+        await parameterGetByCode({
+          code: 'work_hour'
+        }).then((res) => {
+          this.isReportTime = res.value == '1' ? true : false;
+        });
+
         await parameterGetByCode({
           code: 'choose_engrave'
         }).then((res) => {
@@ -705,7 +816,11 @@
         }
       },
 
-      changeId() {
+      changeId(index) {
+        if (this.isReportTime) {
+          this.calculateWorkingHours(index);
+        }
+
         if (this.executorIdList.length == this.teamUserList.length) {
           this.checked = true;
         } else {
@@ -713,12 +828,40 @@
         }
       },
 
-      checkChange() {
+      changeReportTime(index) {
+        if (this.List[index].workReportInfo.reportTime) {
+          this.calculateWorkingHours(index);
+        } else {
+          this.List[index].workReportInfo.workTime = '';
+        }
+      },
+
+      calculateWorkingHours(index) {
+        const startTime = new Date(
+          this.List[index].workReportInfo.reportTime[0]
+        );
+        const endTime = new Date(this.List[index].workReportInfo.reportTime[1]);
+
+        const diffMs = endTime - startTime;
+        const diffHours = diffMs / (1000 * 60 * 60);
+
+        if (this.executorIdList.length != 0) {
+          this.List[index].workReportInfo.workTime =
+            Number(diffHours) * Number(this.executorIdList.length);
+        }
+      },
+
+      checkChange(index) {
         if (this.checked) {
           this.executorIdList = [];
           this.executorIdList = this.teamUserList.map((item) => item.id);
         } else {
           this.executorIdList = [];
+          this.List[index].workReportInfo.workTime = '';
+        }
+
+        if (this.isReportTime) {
+          this.calculateWorkingHours(index);
         }
       },
 
@@ -944,7 +1087,10 @@
                   notFormedNum: null,
                   notFormedWeight: null,
                   lossQuantity: null,
-                  lossWeight: null
+                  lossWeight: null,
+                  executorStartTime: null,
+                  reportTime: '',
+                  workTime: ''
                 };
 
                 obj.notFormedList = [
@@ -1046,7 +1192,7 @@
       },
 
       openPicking(id, item) {
-        this.$refs.pickingListRef.open(id, item);
+        this.$refs.pickingListRef.open(id, item, '选择设备列表');
       },
 
       allSelection(id, selectList) {
@@ -1111,6 +1257,69 @@
         this.teamUserList = this.teamAllList[index];
       },
 
+      toInteger(num) {
+        const len = this.getDecimalLength(num);
+        return {
+          int: Math.round(num * Math.pow(10, len)),
+          factor: Math.pow(10, len)
+        };
+      },
+
+      add(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      getDecimalLength(num) {
+        return (num.toString().split('.')[1] || '').length;
+      },
+
+      async checkReportNum() {
+        for (let item of this.List) {
+          if (item.currentTaskDiagram.isFirstTask == '1') {
+            await checkReportNumber({
+              currentTaskDiagram: item.currentTaskDiagram,
+              workOrderId: item.workOrderId
+            }).then((res) => {
+              const totalNum = Number(item.formingNum);
+              const reportNum = this.add(
+                item.workReportInfo.notFormedNum,
+                item.workReportInfo.formedNum
+              );
+              const totalReportNum = this.add(reportNum, Number(res));
+              console.log(totalReportNum, totalNum, '1111');
+              if (totalReportNum > totalNum) {
+                this.$confirm('报工数量大于生产数量, 是否继续报工?', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  type: 'warning'
+                })
+                  .then(() => {
+                    this.$message({
+                      type: 'success',
+                      message: '删除成功!'
+                    });
+                    return true;
+                  })
+                  .catch(() => {
+                    this.$message({
+                      type: 'info',
+                      message: '已取消删除'
+                    });
+
+                    return false;
+                  });
+              }
+            });
+          }
+        }
+      },
+
       async save(type) {
         const required = await parameterGetByCode({
           code: 'mes_report_engrave_required'
@@ -1118,8 +1327,6 @@
           return res;
         });
 
-        console.log(required, 'required');
-
         if (this.executorIdList.length == 0) {
           return this.$message.error('执行人不能为空!');
         }
@@ -1225,18 +1432,32 @@
           }
         }
 
-        console.log('11111', this.List);
-
         this.loading = this.$loading({
           lock: true,
           text: '加载中',
           background: 'rgba(0, 0, 0, 0.7)'
         });
 
-        let arr = this.List.filter((L) => L.workReportInfo.executorTime);
-        if (!arr.length) {
-          this.loading.close();
-          return this.$message.warning('请选择执行时间');
+        if (this.isReportTime) {
+          let arr = this.List.filter((L) => L.workReportInfo.reportTime);
+          if (!arr.length) {
+            this.loading.close();
+            return this.$message.warning('请选择执行时间');
+          }
+
+          this.List.forEach((item) => {
+            item.workReportInfo.executorStartTime =
+              item.workReportInfo.reportTime[0];
+
+            item.workReportInfo.executorTime =
+              item.workReportInfo.reportTime[1];
+          });
+        } else {
+          let arr = this.List.filter((L) => L.workReportInfo.executorTime);
+          if (!arr.length) {
+            this.loading.close();
+            return this.$message.warning('请选择执行时间');
+          }
         }
 
         // for (let i = 0; i < this.List.length; i++) {
@@ -1321,8 +1542,6 @@
         //   return false;
         // }
 
-        console.log(this.List, 'this.List1111');
-
         if (this.clientEnvironmentId == 3) {
           for (const item of this.List) {
             if (item.singleReport == 0) {
@@ -1381,8 +1600,6 @@
           }
         }
 
-        console.log('123456');
-
         if (this.clientEnvironmentId != 2) {
           for (let i = 0; i < this.List.length; i++) {
             for (let j = 0; j < this.List[i].productRecycleList.length; j++) {
@@ -1406,7 +1623,6 @@
           // }
         }
 
-        console.log(this.item, '9999999999');
         if (this.taskObj.type == 4) {
           if (this.clientEnvironmentId == 3) {
             this.List.forEach((it) => {
@@ -1422,7 +1638,7 @@
           // 	return false
           // }
         }
-        console.log('4444444444', this.List);
+
         if (this.taskObj.type == 1) {
           const isCache = await this.checkCache(type);
 
@@ -1441,7 +1657,6 @@
               L.semiProductList = [];
             }
           });
-          console.log('ashsaoghaoghoasg');
         }
         let isSemiProduct = false;
         this.List.map((semi) => {
@@ -1487,25 +1702,110 @@
           return;
         }
 
-        console.log(this.List, 'this.List');
+        for (let item of this.List) {
+          if (item.currentTaskDiagram.isFirstTask == '1') {
+            await checkReportNumber({
+              currentTaskDiagram: item.currentTaskDiagram,
+              workOrderId: item.workOrderId
+            }).then((res) => {
+              const totalNum = Number(item.formingNum);
+              const reportNum = this.add(
+                item.workReportInfo.notFormedNum,
+                item.workReportInfo.formedNum
+              );
+              const totalReportNum = this.add(reportNum, Number(res));
+              if (totalReportNum > totalNum) {
+                this.$confirm('报工数量大于生产数量, 是否继续报工?', '提示', {
+                  confirmButtonText: '确定',
+                  cancelButtonText: '取消',
+                  type: 'warning'
+                })
+                  .then(() => {
+                    // this.$message({
+                    //   type: 'success',
+                    //   message: '删除成功!'
+                    // });
+                    // return true;
+                    this.loadingBtn = true;
+                    jobSave(this.List)
+                      .then((res) => {
+                        this.loadingBtn = false;
+                        this.loading.close();
+                        this.$message.success('报工成功');
+                        this.checked = false;
+                        this.executorIdList = [];
+                        this.teamId = '';
+                        this.getList(this.idsList);
+                        this.$emit('jobSuccess', 'Success');
+                      })
+                      .catch(() => {
+                        this.loadingBtn = false;
+                        this.loading.close();
+                      });
+                  })
+                  .catch(() => {
+                    this.loading.close();
+                    // this.$message({
+                    //   type: 'info',
+                    //   message: '已取消删除'
+                    // });
+                    // return false;
+                  });
+              } else {
+                this.loadingBtn = true;
+                jobSave(this.List)
+                  .then((res) => {
+                    this.loadingBtn = false;
+                    this.loading.close();
+                    this.$message.success('报工成功');
+                    this.checked = false;
+                    this.executorIdList = [];
+                    this.teamId = '';
+                    this.getList(this.idsList);
+                    this.$emit('jobSuccess', 'Success');
+                  })
+                  .catch(() => {
+                    this.loadingBtn = false;
+                    this.loading.close();
+                  });
+              }
+            });
+          } else {
+            this.loadingBtn = true;
+            jobSave(this.List)
+              .then((res) => {
+                this.loadingBtn = false;
+                this.loading.close();
+                this.$message.success('报工成功');
+                this.checked = false;
+                this.executorIdList = [];
+                this.teamId = '';
+                this.getList(this.idsList);
+                this.$emit('jobSuccess', 'Success');
+              })
+              .catch(() => {
+                this.loadingBtn = false;
+                this.loading.close();
+              });
+          }
+        }
 
-        // this.List[0].product = this.List[0].semiProductList;
-        this.loadingBtn = true;
-        jobSave(this.List)
-          .then((res) => {
-            this.loadingBtn = false;
-            this.loading.close();
-            this.$message.success('报工成功');
-            this.checked = false;
-            this.executorIdList = [];
-            this.teamId = '';
-            this.getList(this.idsList);
-            this.$emit('jobSuccess', 'Success');
-          })
-          .catch(() => {
-            this.loadingBtn = false;
-            this.loading.close();
-          });
+        // this.loadingBtn = true;
+        // jobSave(this.List)
+        //   .then((res) => {
+        //     this.loadingBtn = false;
+        //     this.loading.close();
+        //     this.$message.success('报工成功');
+        //     this.checked = false;
+        //     this.executorIdList = [];
+        //     this.teamId = '';
+        //     this.getList(this.idsList);
+        //     this.$emit('jobSuccess', 'Success');
+        //   })
+        //   .catch(() => {
+        //     this.loadingBtn = false;
+        //     this.loading.close();
+        //   });
         // .finally(() => {
         //   setTimeout(function () {
         //     this.loading.close();

+ 1 - 1
src/views/produce/components/picking/detailed.vue

@@ -270,7 +270,7 @@
             },
             {
               minWidth: 120,
-              prop: 'code',
+              prop: 'categoryCode',
               label: '编码',
               align: 'center',
               fixed: 'left',

+ 223 - 4
src/views/produce/components/picking/newPickingList.vue

@@ -66,9 +66,9 @@
               </el-alert>
             </template>
 
-            <template v-slot:code="{ row }">
+            <!-- <template v-slot:code="{ row }">
               {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
-            </template>
+            </template> -->
 
             <template v-slot:runStatus="{ row }">
               {{ stateList[Number(row.runStatus)] }}
@@ -92,8 +92,8 @@
               {{ row.packingCountBase }} {{ row.minUnit }}
             </template>
 
-            <template v-slot:availableCountBase="{ row }">
-              {{ row.availableCountBase }} {{ row.measuringUnit }}
+            <template v-slot:measureQuantity="{ row }">
+              {{ row.measureQuantity }} {{ row.measuringUnit }}
             </template>
 
             <template v-slot:weight="{ row }">
@@ -152,6 +152,7 @@
     assetPage,
     listInProduct
   } from '@/api/produce/workOrder';
+  import storageApi from '@/api/warehouseManagement';
 
   // import { deepCopy } from '@/utils/util.js';
 
@@ -389,6 +390,210 @@
               ]
             : [])
         ]
+
+        // cloumsAll: [
+        //   {
+        //     width: 45,
+        //     type: 'selection',
+        //     columnKey: 'selection',
+        //     align: 'center',
+        //     reserveSelection: true
+        //   },
+        //   {
+        //     columnKey: 'index',
+        //     label: '序号',
+        //     type: 'index',
+        //     width: 50,
+        //     align: 'center'
+        //   },
+        //   {
+        //     prop: 'categoryCode',
+        //     label: '物品编码'
+        //   },
+        //   {
+        //     prop: 'codeNumber',
+        //     label: '编号',
+        //     showOverflowTooltip: true
+        //   },
+        //   {
+        //     prop: 'categoryName',
+        //     label: '名称',
+        //     showOverflowTooltip: true
+        //   },
+        //   {
+        //     prop: 'brandNum',
+        //     label: '牌号',
+        //     showOverflowTooltip: true
+        //   },
+        //   {
+        //     prop: 'specification',
+        //     label: '规格',
+        //     showOverflowTooltip: true
+        //   },
+        //   // {
+        //   //   prop: 'modelType',
+        //   //   label: '型号',
+        //   //   showOverflowTooltip: true
+        //   // },
+        //   {
+        //     prop: 'categoryModel',
+        //     label: '型号',
+        //     align: 'center',
+        //     showOverflowTooltip: true
+        //   },
+
+        //   {
+        //     prop: 'batchNo',
+        //     label: '批次号',
+        //     align: 'center'
+        //   },
+        //   // {
+        //   //   prop: 'manualBatchNo',
+        //   //   label: '批次号',
+        //   //   align: 'center'
+        //   // },
+        //   {
+        //     prop: 'measureQuantity',
+        //     label: '计量库存数量',
+        //     sortable: 'custom',
+        //     slot: 'measureQuantity',
+        //     showOverflowTooltip: true,
+        //     width: 130,
+        //     align: 'center'
+        //   },
+
+        //   ...([1, 23, 8].includes(Number(this.rootCategoryLevelId))
+        //     ? [
+        //         {
+        //           prop: 'packingCountBase',
+        //           label: '包装库存',
+        //           slot: 'packingCountBase',
+        //           showOverflowTooltip: true
+        //         }
+        //       ]
+        //     : []),
+
+        //   {
+        //     prop: 'weight',
+        //     label: '重量',
+        //     showOverflowTooltip: true,
+        //     slot: 'weight'
+        //   },
+
+        //   {
+        //     prop: 'expirationDate',
+        //     slot: 'expirationDate',
+        //     label: '库存保质期',
+        //     width: 100
+        //   },
+        //   {
+        //     prop: 'expirationTime',
+        //     label: '周期倒计时',
+        //     showOverflowTooltip: true,
+        //     width: 100
+        //   },
+        //   {
+        //     prop: 'qualityResult',
+        //     slot: 'qualityResult',
+        //     label: '质检结果',
+        //     showOverflowTooltip: true,
+        //     width: 100
+        //   },
+        //   {
+        //     prop: 'qualityStatus',
+        //     slot: 'qualityStatus',
+        //     label: '质检状态',
+        //     showOverflowTooltip: true,
+        //     width: 100
+        //   },
+        //   {
+        //     prop: 'pathName',
+        //     width: 230,
+        //     label: '仓库',
+        //     showOverflowTooltip: true
+        //   },
+
+        //   ...(this.rootCategoryLevelId == '4'
+        //     ? [
+        //         {
+        //           prop: 'workstationName',
+        //           label: '工位',
+        //           showOverflowTooltip: true
+        //         },
+
+        //         {
+        //           prop: 'runStatus',
+        //           label: '状态',
+        //           slot: 'runStatus',
+        //           showOverflowTooltip: true
+        //         }
+        //       ]
+        //     : []),
+
+        //   // ...(this.rootCategoryLevelId == '5'
+        //   //   ? [
+        //   //       {
+        //   //         prop: 'dieHoleNum',
+        //   //         label: '模孔数量',
+        //   //         showOverflowTooltip: true
+        //   //       },
+        //   //       {
+        //   //         prop: 'mandrelDiameter',
+        //   //         label: '芯棒直径',
+        //   //         showOverflowTooltip: true
+        //   //       },
+        //   //       {
+        //   //         prop: 'shrinkEffictive',
+        //   //         label: '收缩系数',
+        //   //         showOverflowTooltip: true
+        //   //       }
+        //   //     ]
+        //   //   : []),
+
+        //   // ...(this.rootCategoryLevelId == '7'
+        //   //   ? [
+        //   //       {
+        //   //         prop: 'materialQuality',
+        //   //         label: '材质',
+        //   //         showOverflowTooltip: true
+        //   //       },
+
+        //   //       {
+        //   //         prop: 'vehicleLen',
+        //   //         label: '长宽高',
+        //   //         slot: 'vehicleLen',
+        //   //         showOverflowTooltip: true
+        //   //       }
+        //   //     ]
+        //   //   : []),
+
+        //   ...(this.rootCategoryLevelId == '8'
+        //     ? [
+        //         {
+        //           prop: 'extInfo.slotNum',
+        //           label: '槽数',
+        //           showOverflowTooltip: true
+        //         }
+        //       ]
+        //     : []),
+
+        //   ...(this.rootCategoryLevelId == '11'
+        //     ? [
+        //         {
+        //           prop: 'status',
+        //           label: '状态',
+        //           slot: 'status',
+        //           showOverflowTooltip: true
+        //         },
+
+        //         {
+        //           prop: 'region',
+        //           label: '位置',
+        //           showOverflowTooltip: true
+        //         }
+        //       ]
+        //     : [])
+        // ]
       };
     },
 
@@ -605,6 +810,8 @@
     methods: {
       /* 表格数据源 */
       async datasource({ page, where, limit }) {
+        const dimension = this.$refs.searchRef.dimension;
+
         let URL;
 
         let param = {
@@ -614,6 +821,14 @@
           categoryLevelId: this.categoryLevelId
         };
         if (this.isType == 'pick') {
+          // if (dimension == 1) {
+          //   URL = storageApi.getProductList;
+          // } else if (dimension == 2) {
+          //   URL = storageApi.getBatchList;
+          // } else if (dimension == 3) {
+          //   URL = storageApi.getPackingList;
+          // }
+          // param.dimension = dimension;
           param.dimension = 1;
 
           // URL = pageeLedgerMain;
@@ -741,6 +956,10 @@
         this.reload();
       },
 
+      handledime() {
+        this.reload(this.$refs.searchRef.where);
+      },
+
       /* 刷新表格 */
       reload(where) {
         this.$nextTick(() => {

+ 4 - 0
src/views/produce/components/picking/outboundDetail.vue

@@ -30,6 +30,10 @@
           <template slot="label"> 牌号 </template>
           {{ outboundData.brandNum }}
         </el-descriptions-item>
+        <!-- <el-descriptions-item>
+          <template slot="label"> 物品编码 </template>
+          {{ outboundData.ca }}
+        </el-descriptions-item> -->
         <el-descriptions-item>
           <template slot="label"> 编码 </template>
           {{ outboundData.categoryCode }}

+ 5 - 3
src/views/produce/components/picking/pickingList.vue

@@ -67,7 +67,7 @@
             </template>
 
             <template v-slot:code="{ row }">
-              {{ row.rootCategoryLevelId == 4 ? row.codeNumber : row.code }}
+              {{ row.rootCategoryLevelId == 4 ? row.code : row.code }}
             </template>
 
             <template v-slot:runStatus="{ row }">
@@ -206,8 +206,9 @@
           },
           {
             prop: 'code',
-            label: '物品编码',
-            slot: 'code'
+            label: this.rootCategoryLevelId == '4' ? '设备编码' : '物品编码',
+            slot: 'code',
+            showOverflowTooltip: true
           },
           {
             prop: 'codeNumber',
@@ -722,6 +723,7 @@
         });
       },
       open(id, item, t) {
+        console.log(item, id, t, this.isType, '1234');
         this.id = id;
 
         if (t) {

+ 22 - 1
src/views/produce/components/picking/pickingListSearch.vue

@@ -29,6 +29,25 @@
         </el-form-item>
       </el-col>
 
+      <!-- <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="列表维度:" prop="dimension">
+          <template>
+            <el-select
+              style="width: 100%"
+              clearable
+              @change="$emit('handledime', $event)"
+              v-model="dimension"
+              placeholder="请选择"
+            >
+              <el-option label="物品维度" value="1" v-if="type === 'products'">
+              </el-option>
+              <el-option label="批次维度" value="2"> </el-option>
+              <el-option label="包装维度" value="3"> </el-option>
+            </el-select>
+          </template>
+        </el-form-item>
+      </el-col> -->
+
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="物品编码:" prop="categoryCode">
           <el-input
@@ -130,7 +149,9 @@
         defaultWhere,
         // 表单数据
         where: { ...defaultWhere },
-        warehouseList: []
+        warehouseList: [],
+        dimension: '2',
+        type: 'products'
       };
     },
     computed: {

+ 785 - 0
src/views/produce/components/warehousing/components/jobBom.vue

@@ -0,0 +1,785 @@
+<template>
+  <div>
+    <div class="title_box rx-bc mt6">
+      <div class="name">报工信息 </div>
+
+      <div class="rx-bc"> </div>
+    </div>
+
+    <div class="material">
+      <div class="content_table">
+        <!-- <div class="item rx-sc"> -->
+        <!-- <div
+            class="rx ww33"
+            v-if="
+              Object.prototype.hasOwnProperty.call(item, 'product') &&
+              clientEnvironmentId != 3
+            "
+          >
+            <div class="lable rx-cc">投料数量</div>
+            <div class="content">
+              {{ item.product[0] && item.product[0].feedQuantity }}
+            </div>
+          </div> -->
+        <!--
+          <div class="rx ww33">
+            <div class="lable lable100 rx-cc">要求生产数量</div>
+            <div class="content">{{ item.formingNum }} {{ item.unit }}</div>
+          </div>
+
+          <div class="rx ww33">
+            <div class="lable rx-cc">重量</div>
+            <div class="content"
+              >{{ item.formingWeight }}{{ item.weightUnit }}</div
+            >
+          </div>
+        </div> -->
+
+        <!-- v-if="(clientEnvironmentId == 3 && item.singleReport == 0) ||  taskObj.type == 4 || clientEnvironmentId == 2" -->
+        <div class="item rx-sc">
+          <div class="rx ww40">
+            <div class="lable lable100 rx-cc">合格品数量</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.formedNum"
+                :disabled="isDetails"
+                placeholder="请输入合格品数量"
+              >
+                <template slot="append">{{ item.unit }}</template>
+              </el-input>
+            </div>
+          </div>
+
+          <div class="rx ww40">
+            <div class="lable rx-cc">重量</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.formedWeight"
+                :disabled="isDetails"
+                placeholder="请输入合格品重量"
+              >
+                <template slot="append">{{ item.weightUnit }}</template>
+              </el-input>
+            </div>
+          </div>
+        </div>
+        <!-- v-if="(clientEnvironmentId == 3 && item.singleReport == 0) || taskObj.type == 4 || clientEnvironmentId == 2" -->
+        <!-- v-for="(not, notIndex) in notFormedList" :key="notIndex" -->
+
+        <div class="item rx-sc">
+          <div class="rx ww40">
+            <div class="lable lable100 rx-cc">不合格数量</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.notFormedNum"
+                :disabled="isDetails"
+                placeholder="请输入不合格数量"
+              >
+                <template slot="append">{{ item.unit }}</template>
+              </el-input>
+            </div>
+          </div>
+
+          <div class="rx ww40">
+            <div class="lable rx-cc">重量</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.notFormedWeight"
+                :disabled="isDetails"
+                placeholder="请输入不合格品重量"
+              >
+                <template slot="append">{{ item.weightUnit }}</template>
+              </el-input>
+            </div>
+          </div>
+
+          <!-- <div class="rw ww20 rx-cc">
+            <div class="penalize" v-if="!isDetails" :style="{ background: not.warehouseId ? '#FFA07A' : '' }"
+              @click="penalize">
+              处置</div>
+            <div class="penalize" v-if="isDetails" :style="{ background: not.warehouseId ? '#FFA07A' : '' }" @click="
+              handleView(isDetails ? not.warehouseName : item.warehouseName)
+              ">
+              查看</div>
+          </div> -->
+        </div>
+
+        <div class="item rx-sc">
+          <div class="rx ww40">
+            <div class="lable lable100 rx-cc">损耗数量</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.lossQuantity"
+                :disabled="isDetails"
+                placeholder=""
+              >
+                <template slot="append">{{ item.unit }}</template>
+              </el-input>
+            </div>
+          </div>
+
+          <div class="rx ww40">
+            <div class="lable rx-cc">重量</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.lossWeight"
+                :disabled="isDetails"
+                placeholder=""
+              >
+                <template slot="append">{{ item.weightUnit }}</template>
+              </el-input>
+            </div>
+          </div>
+
+          <!-- <div class="rw ww20 rx-cc">
+            <div class="penalize" v-if="!isDetails" :style="{ background: not.warehouseId ? '#FFA07A' : '' }"
+              @click="penalize">
+              处置</div>
+            <div class="penalize" v-if="isDetails" :style="{ background: not.warehouseId ? '#FFA07A' : '' }" @click="
+              handleView(isDetails ? not.warehouseName : item.warehouseName)
+              ">
+              查看</div>
+          </div> -->
+        </div>
+
+        <!-- 报工备注 -->
+        <div class="item rx-sc">
+          <div
+            class="rx ww43"
+            v-if="
+              Object.prototype.hasOwnProperty.call(item, 'product') &&
+              clientEnvironmentId != 3
+            "
+          >
+            <div class="lable lable100 rx-cc">报工备注</div>
+            <div class="content content_num rx-sc">
+              <el-input
+                size="mini"
+                :disabled="isDetails"
+                v-model="item.workReportInfo.remark"
+                placeholder="请输入报工备注"
+              >
+              </el-input>
+            </div>
+          </div>
+
+          <div class="rx ww43" v-if="clientEnvironmentId == 2">
+            <div class="lable lable100 rx-cc">批次号</div>
+            <div class="content content_num rx-sc">
+              {{ item.batchNo }}
+              <el-input
+                size="mini"
+                v-model="item.workReportInfo.batchNo"
+                placeholder="请输入批次号"
+              ></el-input>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <el-dialog
+      title="仓库处置"
+      :visible.sync="visible"
+      :before-close="handleClose"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      append-to-body
+      width="500px"
+    >
+      <el-form size="mini" :model="form" label-width="96px">
+        <el-form-item label="仓库" prop="warehouseList">
+          <el-select
+            v-model="form.warehouseId"
+            placeholder="请选择仓库"
+            filterable
+          >
+            <el-option
+              v-for="item in warehouseList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+
+      <template slot="footer">
+        <el-button size="mini" @click="visible = false">取 消</el-button>
+        <el-button size="mini" type="primary" @click="warehouseSave"
+          >保 存</el-button
+        >
+      </template>
+    </el-dialog>
+  </div>
+</template>
+<script>
+  import {
+    createInProductBatchTG,
+    createInProductBatch
+  } from '@/api/produce/workOrder';
+
+  export default {
+    props: {
+      item: {
+        type: Object,
+        default: () => {}
+      },
+      notFormed: {
+        type: Array,
+        default: () => []
+      },
+      isDetails: {
+        type: Boolean,
+        default: false
+      },
+      warehouseList: {
+        type: Array,
+        default: () => []
+      }
+    },
+
+    watch: {
+      notFormed: {
+        immediate: true,
+        deep: true,
+        handler(newVal) {
+          this.notFormedList = newVal;
+          console.log('更新notFormed', this.notFormedList);
+        }
+      },
+      item: {
+        immediate: true,
+        deep: true,
+        handler(newVal) {
+          // this.$set(this.item, 'workReportInfo', newVal.workReportInfo);
+          console.log(newVal, '修改后的数据');
+          if (newVal.product && newVal.product.length != 0) {
+            let formedNum = 0;
+            let notFormedNum = 0;
+            let lossNum = 0;
+
+            newVal.product.forEach((item) => {
+              if (
+                (!item.extInfo.isQualified ||
+                  item.extInfo.isQualified == 1 ||
+                  item.extInfo.isQualified == 3) &&
+                !item.extInfo.isLoss
+              ) {
+                formedNum = this.add(formedNum, Number(item.feedQuantity));
+              } else if (!item.extInfo.isLoss) {
+                if (item.extInfo.notType == 5 || item.extInfo.notType == 8) {
+                  formedNum = this.add(formedNum, Number(item.feedQuantity));
+                } else {
+                  notFormedNum = this.add(
+                    notFormedNum,
+                    Number(item.feedQuantity)
+                  );
+                }
+              } else if (item.extInfo.isLoss == 1) {
+                lossNum = this.add(lossNum, Number(item.feedQuantity));
+              }
+            });
+
+            this.$set(this.item.workReportInfo, 'formedNum', formedNum);
+            this.$set(this.item.workReportInfo, 'notFormedNum', notFormedNum);
+            this.$set(this.item.workReportInfo, 'lossQuantity', lossNum);
+          }
+
+          // if (
+          //   this.clientEnvironmentId == 3 &&
+          //   this.item.currentTaskDiagram.type == 6
+          // ) {
+          //   if (newVal.semiProductList.length != 0) {
+          //     const semiList = newVal.semiProductList;
+          //     // if(semiList.ba)
+          //   }
+          // }
+          // this.set()
+          // if(this.taskObj.type == 6 ){
+          //   console.log('112334',newVal)
+          // }
+          // let weightValue=parseFloat((newVal.workReportInfo.formedWeight).toFixed(2))
+          // this.$set(this.item.workReportInfo,'formedWeight',weightValue)
+        }
+      }
+    },
+
+    computed: {
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      },
+
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
+    },
+
+    data() {
+      return {
+        notFormedList: [],
+
+        form: {
+          warehouseId: null
+        },
+
+        visible: false
+      };
+    },
+
+    created() {
+      if (this.isDetails) {
+        this.notFormedList = this.notFormedList.map((m) => {
+          return {
+            notFormedNum: Number(m.quantity),
+            notFormedWeight: m.weight,
+            ...m
+          };
+        });
+      }
+      // if(item.semiProductList){
+      //   let allReportWeight=0
+      //    item.semiProductList.map(sitem=>{
+      //     if(sitem.extInfo.batchReportInfo){
+      //       sitem.extInfo.batchReportInfo.map(bitem=>{
+      //         allReportWeight=allReportWeight+bitem.allReportWeight
+      //       })
+      //       this.item.workReportInfo.formedWeight=allReportWeight
+      //     }
+      //    })
+      // }
+    },
+
+    mounted() {
+      console.log(this.item, '传过来的item');
+    },
+
+    methods: {
+      penalize() {
+        this.visible = true;
+      },
+
+      handleClose() {
+        this.visible = false;
+      },
+
+      toInteger(num) {
+        const len = this.getDecimalLength(num);
+        return {
+          int: Math.round(num * Math.pow(10, len)),
+          factor: Math.pow(10, len)
+        };
+      },
+
+      add(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      sub(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      getDecimalLength(num) {
+        return (num.toString().split('.')[1] || '').length;
+      },
+
+      warehouseSave() {
+        this.$set(
+          this.item.notFormedList[0],
+          'warehouseId',
+          this.form.warehouseId || null
+        );
+
+        this.handleClose();
+        this.$forceUpdate();
+      },
+
+      handleView(name) {
+        this.$message.info(name || '未设置');
+      },
+
+      getDelete(index) {
+        this.list.splice(index, 1);
+      },
+
+      blurNum() {
+        // let total =
+        //   Number(this.item.workReportInfo.formedNum) +
+        //   Number(this.item.workReportInfo.notFormedNum);
+        // if (total > this.item.formingNum) {
+        //   this.item.workReportInfo.formedNum = 0;
+        //   this.$message.warning('合格品数量加不合格数量不能大于要求生产数量');
+        // }
+
+        // let total =
+        //   Number(this.item.workReportInfo.formedNum) +
+        //   Number(this.notFormedList[0].notFormedNum);
+
+        // console.log(total, '9****');
+
+        // this.$emit('modeNum', total);
+
+        // if (
+        //   this.item.product[0] &&
+        //   this.item.product[0].feedQuantity > 0 &&
+        //   Number(this.item.workReportInfo.formedNum)
+        // ) {
+        //   this.$set(
+        //     this.notFormedList[0],
+        //     'notFormedNum',
+        //     this.item.product[0].feedQuantity -
+        //     Number(this.item.workReportInfo.formedNum)
+        //   );
+        //   this.notForme();
+        // }
+
+        // let weight =
+        //   Number(this.item.workReportInfo.formedNum) *
+        //   Number(this.item.singleWeight) *
+        //   Number(this.item.weightMultiple);
+
+        // if (['G', 'g', '克'].includes(this.item.singleWeightUnit)) {
+        //   weight = parseFloat((weight / 1000).toFixed(2));
+        // } else {
+        //   weight = parseFloat(weight.toFixed(2));
+        // }
+
+        // console.log(this.item, 'weight');
+
+        // this.$set(this.item.workReportInfo, 'formedWeight', weight);
+
+        this.$forceUpdate();
+      },
+
+      notForme() {
+        console.log('0010001000100100');
+        let weight =
+          Number(this.notFormedList[0].notFormedNum) *
+          Number(this.item.singleWeight) *
+          Number(this.item.weightMultiple);
+        if (
+          this.item.singleWeightUnit == 'G' ||
+          this.item.singleWeightUnit == 'g' ||
+          this.item.singleWeightUnit == '克'
+        ) {
+          weight = parseFloat((weight / 1000).toFixed(2));
+        } else {
+          weight = parseFloat(weight.toFixed(2));
+        }
+        this.$set(this.notFormedList[0], 'notFormedWeight', weight);
+
+        if (
+          this.item.product[0] &&
+          this.item.product[0].feedQuantity > 0 &&
+          Number(this.notFormedList[0].notFormedNum)
+        ) {
+          this.$set(
+            this.item.workReportInfo,
+            'formedNum',
+            this.item.product[0].feedQuantity -
+              Number(this.notFormedList[0].notFormedNum)
+          );
+
+          let weight =
+            Number(this.item.workReportInfo.formedNum) *
+            Number(this.item.singleWeight) *
+            Number(this.item.weightMultiple);
+          if (
+            this.item.singleWeightUnit == 'G' ||
+            this.item.singleWeightUnit == 'g' ||
+            this.item.singleWeightUnit == '克'
+          ) {
+            weight = parseFloat((weight / 1000).toFixed(2));
+          } else {
+            weight = parseFloat(weight.toFixed(2));
+          }
+          this.$set(this.item.workReportInfo, 'formedWeight', weight);
+        }
+
+        this.$forceUpdate();
+      },
+
+      changeNum() {
+        // let total =
+        //   Number(this.item.workReportInfo.formedNum) +
+        //   Number(this.item.workReportInfo.notFormedNum);
+        // if (total > this.item.formingNum) {
+        //   this.item.workReportInfo.notFormedNum = 0;
+        //   this.$message.warning('合格品数量加不合格数量不能大于要求生产数量');
+        // }
+        // this.notForme();
+        // this.blurNum()
+      },
+
+      singleBatch() {
+        // console.log(this.item.workReportInfo);
+        // return;
+        if (!this.item.workReportInfo.formedNum)
+          return this.$message.info('请输入合格品数');
+
+        if (
+          this.item.workReportInfo.notFormedNum === '' ||
+          this.item.workReportInfo.notFormedNum == null
+        )
+          return this.$message.info('请输入不合格品数');
+
+        const req = {
+          formedNum: this.item.workReportInfo.formedNum,
+          notFormedNum: this.item.workReportInfo.notFormedNum || 0,
+          taskId: this.item.currentTaskDiagram.taskId,
+          workOrderId: this.item.workReportInfo.workOrderId,
+          formedWeight: this.item.workReportInfo.formedWeight,
+          notFormedWeight: this.item.workReportInfo.notFormedWeight
+        };
+
+        createInProductBatch(req).then((res) => {
+          if (res && res.length) {
+            this.forValue = res[0];
+
+            // const engrave = res.map((item, index) => {
+            //   if (!item.extInfo.engrave) {
+            //     item.extInfo.engrave = index + 1;
+            //   }
+
+            //   return item;
+            // });
+
+            // this.list = engrave;
+            // this.item.product = engrave;
+
+            // res.map((v) => {
+            //   v.selected = true;
+            //   v.extInfo.batchReportInfo = [
+            //     {
+            //       allFeedQuantity: '',
+            //       allReportWeight: '',
+            //       taskId: '',
+            //       taskName: ''
+            //     }
+            //   ];
+
+            //   v.extInfo.notBatchReportInfo = [
+            //     {
+            //       allFeedQuantity: '',
+            //       notType: '',
+            //       taskId: '',
+            //       taskName: '',
+            //       notReason: ''
+            //     }
+            //   ];
+            // });
+            this.list = res;
+            this.item.product = res;
+          }
+        });
+      },
+      singleQuery() {
+        if (!this.item.workReportInfo.formedNum)
+          return this.$message.info('请输入合格品数');
+
+        if (
+          this.item.workReportInfo.notFormedNum === '' ||
+          this.item.workReportInfo.notFormedNum == null
+        )
+          return this.$message.info('请输入不合格品数');
+
+        const req = {
+          formedNum: this.item.workReportInfo.formedNum,
+          notFormedNum: this.item.workReportInfo.notFormedNum || 0,
+          taskId: this.item.currentTaskDiagram.taskId,
+          workOrderId: this.item.workReportInfo.workOrderId,
+          formedWeight: this.item.workReportInfo.formedWeight,
+          notFormedWeight: this.item.workReportInfo.notFormedWeight
+        };
+
+        createInProductBatchTG(req).then((res) => {
+          if (res && res.length) {
+            this.forValue = res[0];
+
+            // res.map((v) => {
+            //   v.selected = true;
+            //   v.extInfo.batchReportInfo = [
+            //     {
+            //       allFeedQuantity: v.extInfo.allFeedQuantity,
+            //       allReportWeight: v.extInfo.allReportWeight,
+            //       taskId: '',
+            //       taskName: ''
+            //     }
+            //   ];
+
+            //   v.extInfo.notBatchReportInfo = [
+            //     {
+            //       allFeedQuantity: v.extInfo.allFeedQuantity,
+            //       allReportWeight: v.extInfo.allReportWeight,
+            //       notType: '',
+            //       taskId: '',
+            //       taskName: '',
+            //       notReason: ''
+            //     }
+            //   ];
+            // });
+            this.list = res;
+            this.item.semiProductList = res;
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .lable {
+    width: 200px;
+  }
+
+  .penalize {
+    width: 80px;
+    line-height: 30px;
+    background: #157a2c;
+    font-size: 12px;
+    text-align: center;
+    color: #fff;
+    cursor: pointer;
+  }
+
+  .content_table {
+    width: 100%;
+    border: 1px solid #e3e5e5;
+    position: relative;
+
+    .item {
+      display: flex;
+      border-bottom: 1px solid #e3e5e5;
+
+      .lable {
+        width: 72px;
+        text-align: center;
+        background-color: #f7f9fa;
+        font-size: 12px;
+        border-right: 1px solid #e3e5e5;
+        flex-shrink: 0;
+      }
+
+      .lable80 {
+        width: 80px !important;
+        font-size: 12px;
+      }
+
+      .lable90 {
+        width: 90px !important;
+      }
+
+      .lable100 {
+        width: 100px !important;
+      }
+
+      .ww60 {
+        width: 60px;
+      }
+
+      .content {
+        width: 250px;
+        min-height: 32px;
+        font-size: 14px;
+        line-height: 14px;
+        font-style: normal;
+        font-weight: 400;
+        padding: 9px 4px;
+        box-sizing: border-box;
+        word-wrap: break-word;
+        flex-grow: 1 !important;
+
+        .unit {
+          padding: 0 2px;
+          font-size: 12px;
+          color: #404446;
+        }
+      }
+
+      .content_num {
+        display: flex;
+        align-items: center;
+        padding: 2px;
+        --input-background-color: #f0f8f2;
+      }
+
+      .pd2 {
+        padding: 2px 4px;
+      }
+
+      &:last-child {
+        border-bottom: none;
+      }
+    }
+
+    .ww55 {
+      width: 55%;
+    }
+
+    .ww50 {
+      width: 50%;
+    }
+
+    .ww45 {
+      width: 45%;
+    }
+
+    .ww40 {
+      width: 40%;
+    }
+
+    .ww30 {
+      width: 30%;
+    }
+
+    .ww33 {
+      width: 33.33%;
+    }
+
+    .ww20 {
+      width: 20%;
+    }
+
+    .del_box {
+      position: absolute;
+      right: 2px;
+      top: 2px;
+    }
+
+    .sort_index {
+      position: absolute;
+      left: 2px;
+      top: 2px;
+      width: 14px;
+      height: 14px;
+      line-height: 14px;
+      text-align: center;
+      color: #fff;
+      font-size: 12px;
+      border-radius: 50%;
+      background: rgb(21, 122, 44);
+    }
+  }
+  .btn-margin {
+    margin: 10px 0 10px 100px;
+  }
+</style>

+ 23 - 3
src/views/produce/components/warehousing/index.vue

@@ -81,7 +81,7 @@
             </el-option>
           </el-select>
         </div>
-
+        <!--
         <div>
           <jobDdBom
             :item="item"
@@ -89,6 +89,23 @@
             :notFormed="item.notFormedList"
             :warehouseList="warehouseList"
           ></jobDdBom>
+        </div> -->
+
+        <div v-if="item.singleReport == 0">
+          <jobBom
+            :item="item"
+            ref="jobBomRef"
+            :notFormed="item.notFormedList"
+            :warehouseList="warehouseList"
+          ></jobBom>
+        </div>
+        <div v-if="item.singleReport == 1">
+          <jobDdBom
+            :item="item"
+            ref="jobRef"
+            :notFormed="item.notFormedList"
+            :warehouseList="warehouseList"
+          ></jobDdBom>
         </div>
 
         <div v-if="clientEnvironmentId == 3">
@@ -511,7 +528,7 @@
   } from '@/api/produce/workOrder';
 
   import { jobSave } from '@/api/produce/workOrder';
-  // import jobDdBom from './components/jobDdBom.vue';
+  import jobBom from './components/jobBom.vue';
   import jobDdBom from './components/newJobDdBom.vue';
   import { parameterGetByCode } from '@/api/system/dictionary-data';
   import { getTeam } from '@/api/produce/job.js';
@@ -523,6 +540,7 @@
       packagingGroupingTwx,
       packingTgBom,
       jobDdBom,
+      jobBom,
       batchSemiProductJobBom
     },
     props: {
@@ -637,7 +655,9 @@
                 formedNum: null,
                 formedWeight: null,
                 taskId: '',
-                executorTime: null
+                executorTime: null,
+                lossQuantity: null,
+                lossWeight: null
               };
 
               obj.notFormedList = [

+ 68 - 12
src/views/produce/components/workPlan/components/baseInfo.vue

@@ -176,9 +176,8 @@
             v-if="showArrange == '1'"
           >
             <el-input
-              type="number"
               :min="0"
-              @input="limitation('qualifiedNumber')"
+              @input="limitation('qualifiedNumber', form.qualifiedNumber)"
               @blur="quantityCalculation('qualifiedNumber')"
               v-model="form.qualifiedNumber"
               placeholder="请输入"
@@ -192,9 +191,8 @@
             v-if="showArrange == '1'"
           >
             <el-input
-              type="number"
               :min="0"
-              @input="limitation('noQualifiedNumber')"
+              @input="limitation('noQualifiedNumber', form.noQualifiedNumber)"
               @blur="quantityCalculation('noQualifiedNumber')"
               v-model="form.noQualifiedNumber"
               placeholder="请输入"
@@ -554,12 +552,34 @@
       },
 
       // *** 只能输入大于0的数字
-      limitation(val) {
-        this.form[val] =
-          this.form[val].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
+      limitation(val, num) {
+        let newVal = num.replace(/[^\d.]/g, '');
+
+        if (newVal.startsWith('.')) {
+          newVal = '';
+        }
+
+        const firstDotIndex = newVal.indexOf('.');
+        if (firstDotIndex !== -1) {
+          newVal =
+            newVal.slice(0, firstDotIndex + 1) +
+            newVal.slice(firstDotIndex + 1).replace(/\./g, '');
+        }
+
+        const match = newVal.match(/^(\d+)(\.\d{0,9})?/);
+        if (val == 'qualifiedNumber') {
+          this.form.qualifiedNumber = match ? match[0] : '';
+        }
+
+        if (val == 'noQualifiedNumber') {
+          this.form.noQualifiedNumber = match ? match[0] : '';
+        }
+
+        // this.form[val] =
+        //   this.form[val].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
       },
       // *** 计算合格数 不合格数
-      quantityCalculation() {
+      quantityCalculation(e) {
         console.log('执行没有');
         let qualifiedNumber = this.form.qualifiedNumber - 0;
         let noQualifiedNumber = this.form.noQualifiedNumber - 0;
@@ -567,18 +587,22 @@
         let val =
           e == 'qualifiedNumber' ? 'noQualifiedNumber' : 'qualifiedNumber';
         if (this.form[e] > this.form.total) {
-          this.form[e] = this.form.total - this.form[val];
+          // this.form[e] = this.form.total - this.form[val];
+          this.form[e] = this.sub(this.form.total, this.form[val]);
           this.$message.warning('合格数与不合格数不能大于总数量');
           return;
         }
 
-        this.form[val] = this.form.total - this.form[e];
+        // this.form[val] = this.form.total - this.form[e];
+        this.form[val] = this.sub(this.form.total, this.form[e]);
 
         if (e == 'qualifiedNumber') {
-          noQualifiedNumber = total - this.form.qualifiedNumber;
+          noQualifiedNumber = this.sub(total, this.form.qualifiedNumber);
+          // noQualifiedNumber = total - this.form.qualifiedNumber;
         }
         if (e == 'noQualifiedNumber') {
-          qualifiedNumber = total - this.form.noQualifiedNumber;
+          qualifiedNumber = this.sub(total, this.form.noQualifiedNumber);
+          // qualifiedNumber = total - this.form.noQualifiedNumber;
         }
         console.log(qualifiedNumber, 'qualifiedNumber');
         console.log(noQualifiedNumber, 'noQualifiedNumber');
@@ -604,6 +628,38 @@
         // return true;
       },
 
+      getDecimalLength(num) {
+        return (num.toString().split('.')[1] || '').length;
+      },
+
+      toInteger(num) {
+        const len = this.getDecimalLength(num);
+        return {
+          int: Math.round(num * Math.pow(10, len)),
+          factor: Math.pow(10, len)
+        };
+      },
+
+      add(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) + bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
+      sub(a, b) {
+        const { int: aInt, factor: aFactor } = this.toInteger(a);
+        const { int: bInt, factor: bFactor } = this.toInteger(b);
+        const maxFactor = Math.max(aFactor, bFactor);
+        return (
+          (aInt * (maxFactor / aFactor) - bInt * (maxFactor / bFactor)) /
+          maxFactor
+        );
+      },
+
       toggleExpand() {
         this.isExpanded = !this.isExpanded;
       },

+ 4 - 0
src/views/produce/index.vue

@@ -1369,6 +1369,10 @@
     background: #f0f3f3;
   }
 
+  ::v-deep.el-tree-node__content > .el-tree-node__expand-icon {
+    padding-left: 0 !important;
+  }
+
   // .menu-container {
   //   position: relative;
   //   width: 200px;

+ 2 - 2
src/views/produceWord/index.vue

@@ -119,7 +119,7 @@ r++<template>
         ],
         cacheKeyUrl: '0c2fb832-mes-produceWord',
         columnsVersion: 0,
-        tableHeight: 'calc(100vh - 365px)'
+        tableHeight: 'calc(100vh - 380px)'
       };
     },
     computed: {
@@ -348,7 +348,7 @@ r++<template>
         if (fullscreen) {
           this.tableHeight = 'calc(100vh - 120px)';
         } else {
-          this.tableHeight = 'calc(100vh - 365px)';
+          this.tableHeight = 'calc(100vh - 380px)';
         }
       },
 

+ 2 - 2
src/views/sample/index.vue

@@ -204,7 +204,7 @@
         ],
         activeName: '1',
         disposeStatusList: [],
-        tableHeight: 'calc(100vh - 360px)'
+        tableHeight: 'calc(100vh - 370px)'
       };
     },
     created() {
@@ -267,7 +267,7 @@
         if (fullscreen) {
           this.tableHeight = 'calc(100vh - 120px)';
         } else {
-          this.tableHeight = 'calc(100vh - 360px)';
+          this.tableHeight = 'calc(100vh - 370px)';
         }
       },
 

+ 3 - 0
src/views/unacceptedProduct/components/create.vue

@@ -139,6 +139,9 @@
         <el-table-column label="工序" align="center" prop="produceTaskName">
         </el-table-column>
 
+        <!-- <el-table-column label="不良类型" align="center" prop="produceTaskName">
+        </el-table-column> -->
+
         <el-table-column label="原因" align="center" prop="unqualifiedReason">
           <template slot-scope="scope">
             <el-form-item

+ 5 - 0
src/views/unacceptedProduct/index.vue

@@ -29,6 +29,10 @@
           {{ getQuality(row) }}
         </template>
 
+        <template v-slot:quantity="{ row }">
+          {{ row.quantity }}{{ row.measureUnit }}
+        </template>
+
         <template v-slot:status="{ row }">
           {{ getDispose(row) }}
         </template>
@@ -164,6 +168,7 @@
           },
           {
             prop: 'quantity',
+            slot: 'quantity',
             label: '数量',
             align: 'center',
             width: 80,

+ 8 - 2
src/views/workOrderList/components/productionDetails.vue

@@ -90,9 +90,15 @@
       produce() {
         // console.log(this.workOrderInfo,99999999);
 
+        this.produceList = [];
+
         produceDetail(this.id).then((res) => {
-          console.log(res, 'res');
-          this.produceList = res.produceDetail;
+          // this.produceList = res.produceDetail;
+          res.produceDetail.forEach((item) => {
+            if (item.taskId != '-2') {
+              this.produceList.push(item);
+            }
+          });
         });
       }
     }