|
@@ -4,7 +4,7 @@
|
|
title="投产"
|
|
title="投产"
|
|
height="400px"
|
|
height="400px"
|
|
v-model="visible"
|
|
v-model="visible"
|
|
- width="800px"
|
|
|
|
|
|
+ width="900px"
|
|
append-to-body
|
|
append-to-body
|
|
draggable
|
|
draggable
|
|
>
|
|
>
|
|
@@ -24,10 +24,10 @@
|
|
<el-form-item label="当前投产批数" prop="lotNumber">
|
|
<el-form-item label="当前投产批数" prop="lotNumber">
|
|
<el-input-number
|
|
<el-input-number
|
|
v-model="form.lotNumber"
|
|
v-model="form.lotNumber"
|
|
- :precision="0"
|
|
|
|
controls-position="right"
|
|
controls-position="right"
|
|
style="width: 150px"
|
|
style="width: 150px"
|
|
@input="handleUpdateLotNumber"
|
|
@input="handleUpdateLotNumber"
|
|
|
|
+ :min="0"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="下达日期" prop="issuanceDate">
|
|
<el-form-item label="下达日期" prop="issuanceDate">
|
|
@@ -49,10 +49,24 @@
|
|
<el-input-number
|
|
<el-input-number
|
|
v-model="form.productionQuantity"
|
|
v-model="form.productionQuantity"
|
|
:precision="0"
|
|
:precision="0"
|
|
|
|
+ :disabled="true"
|
|
controls-position="right"
|
|
controls-position="right"
|
|
style="width: 150px"
|
|
style="width: 150px"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
+ <el-form-item label="尾批" style="align-items: center;" prop="lastLotStatus">
|
|
|
|
+ <el-switch
|
|
|
|
+ v-model="form.lastLotStatus"
|
|
|
|
+ :disabled ="detailsRow.lastLot || detailsRow.status"
|
|
|
|
+ size="large"
|
|
|
|
+ style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
|
|
|
|
+ active-text="是"
|
|
|
|
+ inactive-text="否"
|
|
|
|
+ active-value="1"
|
|
|
|
+ inactive-value="0"
|
|
|
|
+ @change="handleUpdateLastLotStatus"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
</el-form>
|
|
</el-form>
|
|
@@ -66,8 +80,9 @@
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</template>
|
|
</template>
|
|
<script setup>
|
|
<script setup>
|
|
-import { savePlanDetailSubDetail } from "@/api/business/planDetailSubDetail.js";
|
|
|
|
|
|
+import { savePlanDetailSubDetail,getLastLotStatus } from "@/api/business/planDetailSubDetail.js";
|
|
import { listPlanDetailSubDetail } from "@/api/business/planDetailSubDetail.js";
|
|
import { listPlanDetailSubDetail } from "@/api/business/planDetailSubDetail.js";
|
|
|
|
+import { updateLotCodeStatus } from "@/api/business/productionPlanDetail.js";
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
const { proxy } = getCurrentInstance();
|
|
const emit = defineEmits(["handleSaveSuccess"]);
|
|
const emit = defineEmits(["handleSaveSuccess"]);
|
|
@@ -79,7 +94,9 @@ const visible = ref(false);
|
|
const validateLotNumber = (rule, value, callback) => {
|
|
const validateLotNumber = (rule, value, callback) => {
|
|
const min = 0;
|
|
const min = 0;
|
|
const max = detailsRow.value.lotNumber;
|
|
const max = detailsRow.value.lotNumber;
|
|
- if (value <= min) {
|
|
|
|
|
|
+ if (!Number.isInteger(value)) {
|
|
|
|
+ callback(new Error(`当前投产批数不能是小数`));
|
|
|
|
+ } else if (value <= min) {
|
|
callback(new Error("当前投产批数应大于0"));
|
|
callback(new Error("当前投产批数应大于0"));
|
|
} else if (value > max) {
|
|
} else if (value > max) {
|
|
callback(new Error(`当前投产批数不能超过` + max));
|
|
callback(new Error(`当前投产批数不能超过` + max));
|
|
@@ -88,7 +105,12 @@ const validateLotNumber = (rule, value, callback) => {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const validateproductionQuantity = (rule, value, callback) => {
|
|
const validateproductionQuantity = (rule, value, callback) => {
|
|
- const max = detailsRow.value.productionQuantity;
|
|
|
|
|
|
+ if(form.value.lastLotStatus == 1) {
|
|
|
|
+ var max = detailsRow.value.productionQuantity + detailsRow.value.lastLotQuantity;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var max = detailsRow.value.productionQuantity;
|
|
|
|
+ }
|
|
if (value <= 0) {
|
|
if (value <= 0) {
|
|
callback(new Error("当前投产量应大于0"));
|
|
callback(new Error("当前投产量应大于0"));
|
|
} else if (value > max) {
|
|
} else if (value > max) {
|
|
@@ -97,6 +119,23 @@ const validateproductionQuantity = (rule, value, callback) => {
|
|
callback();
|
|
callback();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+const validateSwitch = (rule, value, callback) => {
|
|
|
|
+ if(detailsRow.value.status) {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ if(form.value.lastLotStatus == 0) {
|
|
|
|
+ if (form.value.lotNumber + detailsRow.value.lotTotalNumber == detailsRow.value.totalLotNumber && !detailsRow.value.lastLot) {
|
|
|
|
+ callback(new Error('此次投产应选尾批'));
|
|
|
|
+ } else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ callback();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
const data = reactive({
|
|
const data = reactive({
|
|
form: {
|
|
form: {
|
|
deptId: null,
|
|
deptId: null,
|
|
@@ -114,6 +153,10 @@ const data = reactive({
|
|
{ required: true, message: "当前投产量不能为空", trigger: "blur" },
|
|
{ required: true, message: "当前投产量不能为空", trigger: "blur" },
|
|
{ validator: validateproductionQuantity, trigger: "blur" },
|
|
{ validator: validateproductionQuantity, trigger: "blur" },
|
|
],
|
|
],
|
|
|
|
+ lastLotStatus: [
|
|
|
|
+ { required: false, message: '请选择是否尾批', trigger: ['change', 'blur'] },
|
|
|
|
+ { validator: validateSwitch, trigger: 'blur' }, // 使用自定义验证函数进行验证
|
|
|
|
+ ],
|
|
},
|
|
},
|
|
});
|
|
});
|
|
const { form, rules } = toRefs(data);
|
|
const { form, rules } = toRefs(data);
|
|
@@ -132,18 +175,19 @@ function reset() {
|
|
productionQuantity: 0,
|
|
productionQuantity: 0,
|
|
issuanceDate: proxy.moment().format("YYYY-MM-DD"),
|
|
issuanceDate: proxy.moment().format("YYYY-MM-DD"),
|
|
remark: null,
|
|
remark: null,
|
|
|
|
+ lastLotStatus: 0,
|
|
};
|
|
};
|
|
proxy.resetForm("productRef");
|
|
proxy.resetForm("productRef");
|
|
}
|
|
}
|
|
|
|
|
|
/** 打开抽屉 */
|
|
/** 打开抽屉 */
|
|
-function open(row, Info) {
|
|
|
|
|
|
+function open(row) {
|
|
reset();
|
|
reset();
|
|
visible.value = true;
|
|
visible.value = true;
|
|
loading.value = true;
|
|
loading.value = true;
|
|
-
|
|
|
|
if (row) {
|
|
if (row) {
|
|
detailsRow.value = proxy.deepClone(row);
|
|
detailsRow.value = proxy.deepClone(row);
|
|
|
|
+ console.log(detailsRow.value)
|
|
form.value.id = row.id;
|
|
form.value.id = row.id;
|
|
form.value.productionPlanNo = row.productionPlanNo;
|
|
form.value.productionPlanNo = row.productionPlanNo;
|
|
form.value.productionPlanDetailId = row.productionPlanDetailId;
|
|
form.value.productionPlanDetailId = row.productionPlanDetailId;
|
|
@@ -151,35 +195,76 @@ function open(row, Info) {
|
|
form.value.deptId = row.deptId;
|
|
form.value.deptId = row.deptId;
|
|
form.value.technologicalProcessId = row.technologicalProcessId;
|
|
form.value.technologicalProcessId = row.technologicalProcessId;
|
|
form.value.technologyVersion = row.technologyVersion;
|
|
form.value.technologyVersion = row.technologyVersion;
|
|
|
|
+ form.value.lastLotStatus = row.lastLotStatus
|
|
if (typeof row.pickUpQuantity === "undefined") {
|
|
if (typeof row.pickUpQuantity === "undefined") {
|
|
detailsRow.value.pickUpQuantity = 0;
|
|
detailsRow.value.pickUpQuantity = 0;
|
|
}
|
|
}
|
|
if (typeof row.lotTotalNumber === "undefined") {
|
|
if (typeof row.lotTotalNumber === "undefined") {
|
|
- detailsRow.value.lotTotalNumber = 0
|
|
|
|
|
|
+ detailsRow.value.lotTotalNumber = 0;
|
|
}
|
|
}
|
|
//通过editStatus判断是否是编辑状态
|
|
//通过editStatus判断是否是编辑状态
|
|
if (row.status) {
|
|
if (row.status) {
|
|
form.value.lotNumber = row.lotNumber;
|
|
form.value.lotNumber = row.lotNumber;
|
|
- detailsRow.value.lotNumber = detailsRow.value.totalLotNumber - detailsRow.value.lotTotalNumber + row.lotNumber;
|
|
|
|
|
|
+ detailsRow.value.lotNumber =
|
|
|
|
+ detailsRow.value.totalLotNumber -
|
|
|
|
+ detailsRow.value.lotTotalNumber +
|
|
|
|
+ row.lotNumber;
|
|
form.value.productionQuantity = row.productionQuantity;
|
|
form.value.productionQuantity = row.productionQuantity;
|
|
- detailsRow.value.productionQuantity =detailsRow.value.productionQuantityTotal - detailsRow.value.pickUpQuantity + detailsRow.value.productionQuantity;
|
|
|
|
|
|
+ if(detailsRow.value.lastLot) {
|
|
|
|
+ detailsRow.value.productionQuantity = detailsRow.value.productionQuantityTotal - detailsRow.value.pickUpQuantity + detailsRow.value.productionQuantity ;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ detailsRow.value.productionQuantity = detailsRow.value.productionQuantityTotal - detailsRow.value.pickUpQuantity + detailsRow.value.productionQuantity - detailsRow.value.lastLotQuantity;
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
detailsRow.value.lotNumber = detailsRow.value.totalLotNumber - detailsRow.value.lotTotalNumber;
|
|
detailsRow.value.lotNumber = detailsRow.value.totalLotNumber - detailsRow.value.lotTotalNumber;
|
|
- detailsRow.value.productionQuantity = detailsRow.value.productionQuantityTotal - detailsRow.value.pickUpQuantity
|
|
|
|
|
|
+ //子计划已经有尾批
|
|
|
|
+ if(detailsRow.value.lastLot) {
|
|
|
|
+ detailsRow.value.productionQuantity =
|
|
|
|
+ detailsRow.value.productionQuantityTotal -
|
|
|
|
+ detailsRow.value.pickUpQuantity
|
|
|
|
+ console.log(detailsRow.value.productionQuantity)
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ detailsRow.value.productionQuantity =
|
|
|
|
+ detailsRow.value.productionQuantityTotal -
|
|
|
|
+ detailsRow.value.pickUpQuantity - detailsRow.value.lastLotQuantity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
loading.value = false;
|
|
loading.value = false;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
function handleUpdateLotNumber(data) {
|
|
function handleUpdateLotNumber(data) {
|
|
- if (data * detailsRow.value.oneLotQuantity > detailsRow.value.productionQuantity) {
|
|
|
|
- form.value.productionQuantity = detailsRow.value.productionQuantity
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- form.value.productionQuantity = data * detailsRow.value.oneLotQuantity;
|
|
|
|
- }
|
|
|
|
|
|
+ if (data <= 0) {
|
|
|
|
+ form.value.productionQuantity = 0;
|
|
|
|
+ } else {
|
|
|
|
+ //该批为尾批
|
|
|
|
+ if(form.value.lastLotStatus == 1) {
|
|
|
|
+ if ((data-1) * detailsRow.value.oneLotQuantity >detailsRow.value.productionQuantity) {
|
|
|
|
+ form.value.productionQuantity = detailsRow.value.productionQuantity + detailsRow.value.lastLotQuantity;
|
|
|
|
+ } else {
|
|
|
|
+ form.value.productionQuantity = (data-1) * detailsRow.value.oneLotQuantity + detailsRow.value.lastLotQuantity ;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ if (data * detailsRow.value.oneLotQuantity >detailsRow.value.productionQuantity) {
|
|
|
|
+ form.value.productionQuantity = detailsRow.value.productionQuantity;
|
|
|
|
+ } else {
|
|
|
|
+ form.value.productionQuantity = data * detailsRow.value.oneLotQuantity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function handleUpdateLastLotStatus () {
|
|
|
|
+ handleUpdateLotNumber(form.value.lotNumber)
|
|
|
|
+}
|
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
function handleSave() {
|
|
function handleSave() {
|
|
@@ -191,6 +276,10 @@ function handleSave() {
|
|
proxy.$modal.msgSuccess("保存成功!");
|
|
proxy.$modal.msgSuccess("保存成功!");
|
|
visible.value = false;
|
|
visible.value = false;
|
|
//detailsRow.value.id = detailsRow.value.productionPlanDetailId
|
|
//detailsRow.value.id = detailsRow.value.productionPlanDetailId
|
|
|
|
+ if(detailsRow.value.lotTotalNumber == 0) {
|
|
|
|
+ updateLotCodeStatus({ id: detailsRow.value.productionPlanDetailId, lotCodeStatusCode: 'OKK' }).then((res) => {
|
|
|
|
+ })
|
|
|
|
+ }
|
|
emit("handleSaveSuccess");
|
|
emit("handleSaveSuccess");
|
|
}
|
|
}
|
|
});
|
|
});
|