diff --git a/src/views/wpm_bx/handover_form2.vue b/src/views/wpm_bx/handover_form2.vue
index 9455924f..247ed4f4 100644
--- a/src/views/wpm_bx/handover_form2.vue
+++ b/src/views/wpm_bx/handover_form2.vue
@@ -1,6 +1,6 @@
- 交接物料:{{codeText}}
- 物料总数:{{totalCount}}
- 分批
+
+ {{batchOrign.batch}}
+ 物料总数:
+ {{batchOrign.count}}
+ 分批
+
-
- {{saveCount}}
-
-
-
+
-
-
-
-
-
+
+ 选择物料:
+
+
+
+
+
+ 数量:{{ listItem.count }}
+
-
-
+
+
+ {{ item2.number }}
+
+
@@ -100,15 +111,11 @@ export default {
},
data() {
return {
- selectItems:[],
- loading: false,
mode: "add",
- titleMap: {
- 20: "分批",
- 30: "合批",
- },
+ wm_in:"",
mtype:20,
- saveCount:0,
+ lastBatchNum:1,
+ addBactchNum:1,
form: {
send_date: null,
send_user: null,
@@ -132,8 +139,9 @@ export default {
},
},
batchOrign:{},
- totalCount: 0,
+ wprOptions: [],
materialOptions: [],
+ loading: false,
visible: false,
isSaveing: false,
setFiltersVisible: false,
@@ -148,67 +156,109 @@ export default {
that.form.send_user = that.form.recive_user= userInfo.id;
},
methods: {
+ getWpr(id){
+ let that = this;
+ that.$API.wpm.wpr.list.req({page:0,wm:id}).then((res) => {
+ that.wprOptions = res;
+ });
+ },
+ getNum(batch){
+ let that = this;
+ that.$API.wpm.batchlog.batchesTo.req({batch:batch}).then((res) => {
+ if(res.last_batch_num!==null){
+ that.lastBatchNum = res.last_batch_num;
+ that.addBactchNum = res.last_batch_num+1;
+ }else{
+ that.lastBatchNum = 0;
+ that.addBactchNum = 1;
+ }
+ let obj = { };
+ obj.wm = that.batchOrign.id;
+ obj.batch = that.batchOrign.batch+"-"+that.addBactchNum;
+ that.addBactchNum++;
+ obj.count = 0;
+ obj.handoverbw=[];
+ that.form.handoverb.push(obj);
+ })
+ },
//显示
open(mode = "add",data,mtype) {
this.mode = mode;
this.form.mtype = mtype;
- this.codeText = data.batch;
this.batchOrign = data;
- this.totalCount = data.count;
- let obj = { };
- obj.wm = data.id;
- obj.batch = data.batch+"-1";
- obj.count = data.count;
- this.saveCount = 0;
- this.form.handoverb.push(obj)
+ this.getWpr(data.id);
+ this.getNum(data.batch);
this.visible = true;
return this;
},
+ wm_inChange(index){
+ let that = this;
+ //放入对应的行中的handoverb中,并且在列表中disabled
+ that.wprOptions.forEach(item=>{
+ if(item.id == that.form.handoverb[index].wpr){
+ let obj = {};
+ obj.number = item.number;
+ obj.wpr = item.id;
+ item.disabled = true;
+ that.form.handoverb[index].handoverbw.push(obj);
+ that.form.handoverb[index].wpr = '';
+ }
+ })
+ that.form.handoverb[index].count = that.form.handoverb[index].handoverbw.length;
+ },
+ formWminChange(index,number){
+ let that = this;
+ //放入对应的行中的handoverb中,并且在列表中disabled
+ that.wprOptions.forEach(item=>{
+ if(item.number== number){
+ if(item.disabled){
+ that.$message.error("该物料已被分配");
+ that.form.handoverb[index].wpr = '';
+ }else{
+ item.disabled = true;
+ let obj = {};
+ obj.number = item.number;
+ obj.wpr = item.id;
+ that.form.handoverb[index].handoverbw.push(obj);
+ that.form.handoverb[index].count = that.form.handoverb[index].handoverbw.length;
+ that.form.handoverb[index].wpr = '';
+ }
+ }
+ })
+ },
+ deleteWpr(index1,index2,wpr){
+ let that = this;
+ that.wprOptions.forEach(item=>{
+ if(item.id == wpr){
+ item.disabled = false;
+ }
+ })
+ that.form.handoverb[index1].handoverbw.splice(index2,1);
+ that.form.handoverb[index1].count = that.form.handoverb[index1].handoverbw.length;
+ },
batchAdd(){
let that = this;
- if(that.saveCount>0){
- let indexs = that.form.handoverb.length+1;
- let count = 0;
- that.form.handoverb.forEach(item=>{
- count+=item.count;
- })
- let obj = { };
- obj.wm = that.batchOrign.id;
- obj.batch = that.codeText+"-"+indexs;
- obj.count = that.batchOrign.count - count;
- that.saveCount = 0;
- that.form.handoverb.push(obj)
- }else{
- that.$message.warning("已无可分配数量");
- }
+ let obj = { };
+ obj.wm = that.batchOrign.id;
+ obj.batch = that.batchOrign.batch+"-"+that.addBactchNum;
+ that.addBactchNum++;
+ obj.count =0;
+ obj.handoverbw=[];
+ that.form.handoverb.push(obj)
},
delMaterial(index){
- this.form.handoverb.splice(index,1);
- this.countChange();
- },
-
- countChange(index){
let that = this;
- let totalCount = 0;
- if(this.form.handoverb.length>0){
- this.form.handoverb.forEach(item=>{
- totalCount += item.count;
- })
- let saveCount = that.batchOrign.count-totalCount;
- if(saveCount<0){//数量不能大于总数量
- this.form.handoverb[index].count = 0;
- let total = 0;
- this.form.handoverb.forEach(item=>{
- total += item.count;
+ //解除该记录的wpr的disabled
+ if(that.form.handoverb[index].handoverbw.length>0){
+ that.form.handoverb[index].handoverbw.forEach(item=>{
+ that.wprOptions.forEach(item2=>{
+ if(item2.id == item.wpr){
+ item2.disabled = false;
+ }
})
- this.form.handoverb[index].count = that.batchOrign.count-total;
- that.saveCount = 0;
- }else{
- that.saveCount = that.batchOrign.count-totalCount;
-
- }
-
+ })
}
+ that.form.handoverb.splice(index,1);
},
//提交
submit() {
@@ -267,4 +317,21 @@ export default {
height: 50px;
line-height: 50px;
}
+.wprItem{
+ background: #eeeeee;
+ padding: 0 10px;
+ border-radius: 5px;
+ display: inline-block;
+ position: relative;
+ height: 30px;
+ line-height: 30px;
+ margin-right: 20px;
+}
+.circleCloseFilled{
+ position: absolute;
+ top: -7px;
+ right: -10px;
+ color: red;
+ font-size: 20px;
+}
diff --git a/src/views/wpm_bx/inmIn.vue b/src/views/wpm_bx/inmIn.vue
index 9b2758f6..6e54659a 100644
--- a/src/views/wpm_bx/inmIn.vue
+++ b/src/views/wpm_bx/inmIn.vue
@@ -82,9 +82,9 @@
prop="batch"
min-width="120"
>
-
+
-
+