feat:光子销售发货mioitems创建时可以批次创建

This commit is contained in:
shijing 2026-06-17 16:07:33 +08:00
parent b66f71c2d5
commit 65dc93e166
1 changed files with 43 additions and 1 deletions

View File

@ -90,6 +90,7 @@
v-model="selectBatch" v-model="selectBatch"
value-key="id" value-key="id"
clearable clearable
:multiple="project_code=='gz'&&form.type == 'sale_out'"
filterable filterable
remote = "true" remote = "true"
:style="divStyle" :style="divStyle"
@ -581,6 +582,13 @@ export default {
that.form.count = Number(that.selectObj.count_canmio); that.form.count = Number(that.selectObj.count_canmio);
that.mTracking = that.selectObj.material_.tracking; that.mTracking = that.selectObj.material_.tracking;
that.selectBatchChange(that.selectObj) that.selectBatchChange(that.selectObj)
}else if(that.type == "sale_out"&&that.project_code=='gz'){
that.form.material = that.selectObj.id;
that.form.unit = that.selectObj.unit;
that.form.unit_price = that.selectObj.unit_price;
that.mTracking = that.selectObj.tracking;
that.selectBatch = [];
that.getBatchOptions();
}else{ }else{
var type = this.form.type; var type = this.form.type;
that.form.material = that.selectObj.id; that.form.material = that.selectObj.id;
@ -616,6 +624,26 @@ export default {
let that = this; let that = this;
that.wprList = []; that.wprList = [];
that.mioitems = []; that.mioitems = [];
// gz
if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(items)){
if(items.length === 0){
that.form.batch = "";
that.form.mb = "";
that.form.count = 0;
that.batchcount = 0;
that.form.warehouse = "";
that.inputBatchDisable = false;
return;
}
let totalCount = items.reduce((sum, it) => sum + Number(it.count_canmio || 0), 0);
that.form.batch = items.map(it => it.batch).join(',');
that.form.mb = items.map(it => it.id).join(',');
that.form.count = totalCount;
that.batchcount = totalCount;
that.form.warehouse = items[0].warehouse;
that.inputBatchDisable = true;
return;
}
if(items){ if(items){
if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){ if(that.form.type == 'sale_out'&&that.project_code=='bxerp'){
let count = 0; let count = 0;
@ -876,7 +904,21 @@ export default {
try { try {
let res; let res;
if (that.mode == "add") { if (that.mode == "add") {
res = await that.$API.inm.mioitem.create.req(that.form); if(that.form.type == 'sale_out' && that.project_code == 'gz' && Array.isArray(that.selectBatch) && that.selectBatch.length > 0){
let payload = that.selectBatch.map(b => ({
mio: that.mioId,
material: that.form.material,
batch: b.batch,
mb: b.id,
count: Number(b.count_canmio),
warehouse: b.warehouse,
unit_price: that.form.unit_price,
note: that.form.note || ''
}));
res = await that.$API.inm.mioitem.create.req(payload);
} else {
res = await that.$API.inm.mioitem.create.req(that.form);
}
} else if (that.mode == "edit") { } else if (that.mode == "edit") {
res = await that.$API.inm.mioitem.update.req(that.form.id,that.form); res = await that.$API.inm.mioitem.update.req(that.form.id,that.form);
} }