Browse Source

修改计划完工

hella_online_20240829
lijuncheng 2 months ago
parent
commit
ad21ba9d38
  1. 61
      src/common/basic.js
  2. 141
      src/pages/fg/coms/comReceiptPopup.vue
  3. 34
      src/pages/fg/receiptByPlan.vue

61
src/common/basic.js

@ -878,6 +878,67 @@ export function getBatch8() {
return year + month + day;
}
/**
* 获取前几天和后几天的日期 2024-07-07
*/
export function lastThreeDays(grapDay) {
let dates = [];
for (let i = grapDay; i >= 0; i--) {
// 创建新的Date对象,并减去i天
let date = new Date();
date.setDate(date.getDate() - i);
// 将格式化的日期字符串添加到数组中
dates.push(formatDate(date));
}
for (let i = 0; i <grapDay; i++) {
// 创建新的Date对象,并减去i天
let date = new Date();
date.setDate(date.getDate() + (i+1));
// 将格式化的日期字符串添加到数组中
dates.push(formatDate(date));
}
return dates;
}
//20240702
export function formatDate(date) {
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
}
export function getBeforeDayDate(grapDay) {
const today = new Date();
var resultList = []
//获取前几天
var beforeList = []
var afterList = []
for (var i = 0; i < grapDay; i++) {
beforeList.push(today.getDate() - (i + 1))
}
//获取后几天
var afterList = []
for (var i = 0; i < grapDay; i++) {
afterList.push(today.getDate() + (i + 1))
}
resultList.concat(beforeList)
resultList.push(today)
resultList.concat(afterList)
return resultList;
}
export function getCurrDate() {
var date = new Date();

141
src/pages/fg/coms/comReceiptPopup.vue

@ -29,7 +29,21 @@
</view>
</view>
<view class='split_line'></view>
<view class="title " style="display: flex; align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0;width: 25%;">计划日期</text>
<view class="customerBorder" @click="showSelectDate">
{{planDate}}
</view>
<u-select v-model="showDateSelect" mode="mutil-column-auto"
:list="planDateList" @confirm="confirmSelectDate"></u-select>
<view class="">
<image src="/static/icons/down.svg" mode=""
style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;" @click="showSelectDate">
</image>
</view>
</view>
<view class='split_line'></view>
<view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">物料代码</text>
<view class="customerBorder">
@ -45,17 +59,7 @@
</image>
</view>
</view>
<view class='split_line'></view>
<view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">批次</text>
<uni-easyinput v-model="batch" ></uni-easyinput>
<view class="">
<image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;"
@click="showSelectLine">
</image>
</view>
</view>
<!-- <view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">计划数量</text>
<view class="customerBorder">
@ -81,6 +85,17 @@
</image>
</view>
</view>
<view class='split_line'></view>
<view class="title " style="display: flex;align-items: center;padding: 10rpx;">
<text style=" flex-shrink: 0; width: 25%;">批次</text>
<uni-easyinput v-model="batch"></uni-easyinput>
<view class="">
<image src="" mode="" style=" width: 40rpx;height: 40rpx;margin-left: 20rpx;"
@click="showSelectLine">
</image>
</view>
</view>
<view class='split_line'></view>
</view>
@ -111,7 +126,8 @@
import {
getCurrDate,
getBatch8,
dateFormatData
dateFormatData,
lastThreeDays
} from '@/common/basic.js';
import {
@ -134,9 +150,9 @@
return {
itemCode: '请选择物料信息',
uom: "",
qty:null,
qty: null,
planQty: 0,
goodQty:0,
goodQty: 0,
planNumber: "",
productLineCode: "",
showProductLineSelect: false,
@ -145,14 +161,17 @@
productionLineCode: "",
batch: "",
packUnitName: "请选择包装规格",
packUnit :"",
packUnit: "",
packUnitList: [],
packQtyHint:"",
packQty:0,
packQtyHint: "",
packQty: 0,
showPackUnitSelect: false,
itemCodeList: [],
showItemCodeSelect: false,
workStationCode:""
workStationCode: "",
planDate: '',
showDateSelect:false,
planDateList:[]
}
},
props: {
@ -166,8 +185,10 @@
},
},
methods: {
openRequestPopup() {
this.initData();
this.planDate =getCurrDate()
this.batch = getBatch8()
this.$refs.popup.open('bottom')
},
@ -175,8 +196,8 @@
this.itemCode = '请选择物料信息';
this.uom = ""
this.planQty = 0
this.goodQty =0;
this.packQty=0;
this.goodQty = 0;
this.packQty = 0;
this.planNumber = ""
this.productLineCode = ""
this.showProductLineSelect = false
@ -185,13 +206,16 @@
this.productionLineCode = ""
this.batch = ""
this.packUnitName = "请选择包装规格"
this.packUnit ="",
this.packQtyHint =""
this.packUnit = "",
this.packQtyHint = ""
this.showPackUnitSelect = false
// this.packUnitList = []
this.itemCodeList = []
this.showItemCodeSelect = false
this.workStationCode=""
this.workStationCode = ""
this.planDate=""
this.showDateSelect =false
this.planDateList=[]
},
@ -203,6 +227,11 @@
},
confirm() {
if (!this.planDate) {
this.showErrorMessage('请先选择计划日期');
return;
}
if (this.productionLineName == "请选择生产线") {
this.showErrorMessage("请选择生产线")
return
@ -234,13 +263,13 @@
uom: this.getUomInfo(this.uom),
batch: this.batch,
packUnitName: this.packUnitName,
packUnit:this.packUnit,
packQtyHint:this.packQtyHint,
packQty:this.packQty,
packUnit: this.packUnit,
packQtyHint: this.packQtyHint,
packQty: this.packQty,
planQty: this.planQty,
goodQty:this.goodQty,
goodQty: this.goodQty,
planNumber: this.planNumber,
workStationCode:this.workStationCode
workStationCode: this.workStationCode
};
this.closeRequestPopup();
@ -257,9 +286,36 @@
},
confirmSelectLine(data) {
this.productionLineName = data[0].label+"—"+data[1].label
this.productionLineName = data[0].label + "—" + data[1].label
this.productionLineCode = data[0].value
this.workStationCode = data[1].value
this.clearItemCode()
this.clearPackUnit()
},
clearItemCode(){
this.planDate =getCurrDate()
this.itemCode ="请选择物料信息"
this.uom = ""
this.planQty = 0;
this.goodQty = 0
this.planNumber = ""
},
confirmSelectDate(data) {
this.planDate=data[0].label
},
showSelectDate(){
this.showDateSelect =true;
var list =lastThreeDays(3);
this.planDateList=[]
list.forEach(res=>{
this.planDateList.push({
label :res,
value:""
})
})
},
showSelectLine() {
@ -288,20 +344,24 @@
},
showSelectItemCode() {
if (!this.planDate) {
this.showErrorMessage('请先选择计划日期');
return;
}
if (!this.productionLineCode) {
this.showErrorMessage('请先选择生产线');
return;
}
console.log("当天", getCurrDate())
uni.showLoading({
title: "加载中",
mask: true
})
getPlaneInfoByproductLine(this.productionLineCode, getCurrDate()).then(res => {
getPlaneInfoByproductLine(this.productionLineCode, this.planDate).then(res => {
uni.hideLoading()
if (res.data && res.data.length > 0) {
res.data.forEach(item => {
item.label = item.itemCode + "(" + item.planQty + item.uom + ")"+"("+dateFormatData(item.planDate)+")"
item.label = item.itemCode + "(" + item.planQty + item.uom + ")" + "(" +
dateFormatData(item.planDate) + ")"
item.value = item
})
this.itemCodeList = res.data
@ -322,6 +382,17 @@
this.planQty = productionPlan.planQty;
this.goodQty = productionPlan.goodQty
this.planNumber = productionPlan.number
//
this.clearPackUnit();
},
clearPackUnit(){
this.packUnitName = "请选择包装规格"
this.packUnit = ""
let pack = this.packUnitList.filter(r => r.packUnit == this.packUnit);
this.packQtyHint = "";
this.packQty = 0
},
showSelectPackUnit() {
@ -357,11 +428,11 @@
confirmSelectPackUnit(data) {
this.packUnitName = data[0].label
this.packUnit =data[0].value
this.packUnit = data[0].value
let pack = this.packUnitList.filter(r => r.packUnit == this.packUnit);
this.packQtyHint = pack[0].packQty+"("+this
.getUomInfo(pack[0].uom)+")";
this.packQty =pack[0].packQty
this.packQtyHint = pack[0].packQty + "(" + this
.getUomInfo(pack[0].uom) + ")";
this.packQty = pack[0].packQty
},
getUomInfo(uom) {
let item = getUomInfo(uom);

34
src/pages/fg/receiptByPlan.vue

@ -86,7 +86,7 @@
<view class=" uni-flex uni-row">
<button class="btn_single_clear" hover-class="btn_commit_after" style="margin-right: 50rpx;"
@click="clear">清空</button>
<button class="btn_single_commit" hover-class="btn_commit_after" @click="commit">提交</button>
<button class="btn_single_commit" hover-class="btn_commit_after" @click="submit">提交</button>
</view>
</view>
</view>
@ -235,22 +235,35 @@
}
},
async commit() {
submit() {
if (this.allList.length == 0) {
this.showErrorMessage("请先扫描唯一码")
return;
}
if (this.allList.length < this.dataContent.packQty) {
this.$refs.comMessage.showQuestionMessage("扫描数量小于计划数量,是否提交?", res => {
if (res) {
this.commit()
}
});
} else {
this.commit();
}
try {
},
let params = this.setParams()
console.log(JSON.stringify(params))
async commit() {
try {
uni.showLoading({
title: "提交中...",
mask: true
})
let params = this.setParams()
console.log(JSON.stringify(params))
let list = []
var planData = await planReceiptSubmit(params)
if (planData.data) {
@ -278,7 +291,7 @@
throw new Error("提交失败")
}
createPutawayRequestByPlan(list[0].requestNumber).then(res=>{
createPutawayRequestByPlan(list[0].requestNumber).then(res => {
createInspectRequestByPlan(list[0].requestNumber)
})
@ -307,11 +320,12 @@
this.dataContent.handleQty = 0;
this.dataContent.planQty = planeInfo.data.list[0].planQty
this.dataContent.goodQty = planeInfo.data.list[0].goodQty
this.dataContent.noGoodQty = calc.sub(planeInfo.data.list[0].planQty, planeInfo.data.list[0].goodQty),
this.dataContent.noGoodQty = calc.sub(planeInfo.data.list[0].planQty, planeInfo.data.list[
0].goodQty),
this.dataContent.subList = []
this.showList=[];
this.allList=[]
this.index=1
this.showList = [];
this.allList = []
this.index = 1
}
} else {

Loading…
Cancel
Save