<template>
|
<view>
|
<view class="form">
|
<view class="form-item">
|
<view class="title">源单单号:</view>
|
<view class="righton">
|
<input name="HSourceBillNo" disabled v-model="hform.HSourceBillNo" placeholder="请输入源单单号" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">生产订单:</view>
|
<view class="righton">
|
<input name="HICMOBillNo" disabled v-model="hform.HICMOBillNo" placeholder="请输入生产订单" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">生产资源:</view>
|
<view class="righton">
|
<input name="HSourceName" disabled v-model="hform.HSourceName" placeholder="请输入生产资源" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">产品代码:</view>
|
<view class="righton">
|
<input name="HMaterNumber" disabled v-model="hform.HMaterNumber" placeholder="请输入产品代码" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">产品名称:</view>
|
<view class="righton">
|
<input name="HMaterName" disabled v-model="hform.HMaterName" placeholder="请输入产品名称" />
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">计划数量:</view>
|
<view class="righton">
|
<input name="HPlanQty" disabled v-model="hform.HPlanQty" placeholder="请输入计划数量" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">不良数量:</view>
|
<view class="right">
|
<input name="HBadQty" v-model="hform.HBadQty" placeholder="请输入不良数量" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">报废数量:</view>
|
<view class="right">
|
<input name="HWasterQty" v-model="hform.HWasterQty" placeholder="请输入报废数量" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">报工数量:</view>
|
<view class="right">
|
<input name="HQty" v-model="hform.HQty" placeholder="请输入报工数量" />
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title"><text>*</text>生产班组:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHGroupName" placeholder="请选择生产班组" v-model="hform.HGroupName" @input="HGroupNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>操作员:</view>
|
<view class="right">
|
<uni-combox :candidates="arrayHEmpName" placeholder="请选择接收人" v-model="hform.HEmpName" @input="HEmpNameChange"></uni-combox>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title"><text>*</text>车间:</view>
|
<view class="righton">
|
<input name="HDeptName" disabled v-model="hform.HDeptName" placeholder="请选择车间" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">生产班次:</view>
|
<view class="righton">
|
<input name="HWorkShiftName" disabled v-model="hform.HWorkShiftName" placeholder="请选择生产班次" />
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">开工时间:</view>
|
<view class="righton">
|
<input name="HWorkBeginDate" disabled v-model="hform.HWorkBeginDate" placeholder="请选择开工时间" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">报工时间:</view>
|
<view class="righton">
|
<input name="HWorkReportDate" disabled v-model="hform.HWorkReportDate" placeholder="请选择报工时间" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">单据日期:</view>
|
<view class="righton">
|
<input name="HDate" disabled v-model="hform.HDate" placeholder="请选择开工时间" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">单据号:</view>
|
<view class="righton">
|
<input name="HBillNo" disabled v-model="hform.HBillNo" placeholder="请输入单据号" />
|
</view>
|
</view>
|
|
<view class="tab_area"></view>
|
|
<view class="form-item">
|
<view class="title">制单人:</view>
|
<view class="righton">
|
<input v-model="hform.HMaker" disabled/>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="title">制单日期:</view>
|
<view class="righton">
|
<input name="HMakeDate" disabled v-model="hform.HMakeDate" placeholder="请选择制单日期" />
|
</view>
|
</view>
|
|
<view class="bottom-btn">
|
<button class="btn-a" size="mini" @tap="submit">提交</button>
|
<!-- <button class="btn-b" size="mini" @tap="showMask = true">新增</button> -->
|
<button class="btn-c" size="mini" @tap="goBack">退出</button>
|
</view>
|
</view>
|
</view>
|
</template>
|
<script>
|
import getDateTime from '@/utils/getdateTime.js';
|
import { getUserInfo } from "@/utils/auth.js";
|
export default {
|
data() {
|
return {
|
userInfo:getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
|
arrayHGroupName:[],//生产班组
|
HGroupNameList:[],
|
arrayHEmpName:[],//接收人
|
HEmpNameList:[],
|
|
isEdit: false,
|
eData:{
|
HBillType:'',
|
HSourceInterID:'',
|
HSourceEntryID:'',
|
HSourceBillNo:'',
|
HSourceBillType:'',
|
},
|
hform:{
|
HSourceBillNo:'',
|
HSourceInterID:'',
|
HSourceEntryID:'',
|
HSourceBillType:'',
|
HICMOBillNo:'',
|
HICMOInterID:'',
|
HICMOEntryID:'',
|
HSourceName:'',
|
HSourceID:'',
|
HMaterNumber:'',
|
HMaterName:'',
|
HMaterID:'',
|
|
HPlanQty:0,
|
HBadQty:0,
|
HWasterQty:0,
|
HQty:0,
|
|
HGroupName:'',
|
HGroupID:'',
|
HEmpName:'',
|
HEmpID:'',
|
HDeptName:'',
|
HDeptID:'',
|
HWorkShiftName:'',
|
HWorkShiftID:'',
|
|
HWorkBeginDate:'',
|
HWorkReportDate:getDateTime.dateTimeStr('y-m-d h:i:s'),
|
HDate:getDateTime.dateTimeStr('y-m-d h:i:s'),
|
HBillNo:'',
|
|
HMaker:getUserInfo().Czymc,
|
HMakeDate:getDateTime.dateTimeStr('y-m-d h:i:s'),
|
}
|
}
|
},
|
onLoad(e) {
|
this.eData = e
|
// console.log(this.eData,this.userInfo)
|
this.hform.HSourceBillNo = e.HSourceBillNo
|
this.hform.HSourceInterID = e.HSourceInterID
|
this.hform.HSourceEntryID = e.HSourceEntryID
|
this.hform.HSourceBillType = e.HSourceBillType
|
uni.showLoading({
|
title:'数据加载中'
|
})
|
this.getNewData()
|
this.getDefValByUser()
|
this.getEditData()
|
|
this.getHGroupList()
|
this.getHEmpList()
|
},
|
methods: {
|
//生产班组
|
getHGroupList(){
|
uni.request({
|
url: this.serverUrl + '/Web/GetProductionTeamList_Json',
|
data: { sWhere: "and HUSEORGID = " + uni.getStorageSync('OrganizationID') + "" },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HGroupNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHGroupName[i] = res.data.data[i].班组
|
}
|
this.$forceUpdate();
|
}else{
|
uni.showToast({
|
title:'获取生产班组失败',
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'获取生产班组接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
//选择生产班组
|
HGroupNameChange(e){
|
for(var i=0;i<this.HGroupNameList.length;i++){
|
if(this.HGroupNameList[i].班组 == e){
|
this.hform.HGroupID = this.HGroupNameList[i].HItemID
|
}
|
}
|
},
|
//接收人
|
getHEmpList(){
|
uni.request({
|
url: this.serverUrl + '/Web/GetEmployeeList_Json',
|
data: { Employee: '',HGroupID:0 },
|
success: (res) => {
|
if(res.data.count == 1){
|
this.HEmpNameList = res.data.data
|
for(var i=0;i<res.data.data.length;i++){
|
this.arrayHEmpName[i] = res.data.data[i].HName
|
}
|
this.$forceUpdate();
|
}else{
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
//选择接收人
|
HEmpNameChange(e){
|
for(var i=0;i<this.HEmpNameList.length;i++){
|
if(this.HEmpNameList[i].HName == e){
|
this.hform.HEmpID = this.HEmpNameList[i].HItemID
|
}
|
}
|
},
|
//编辑
|
getEditData(){
|
// console.log(this.eData)
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/GetMESBeginWorkFrom',
|
type: "GET",
|
async: false,
|
dataType: "json",
|
data: {
|
"HSourceInterID": this.eData.HSourceInterID,
|
"HSourceEntryID": this.eData.HSourceEntryID,
|
"HSourceBillNo": this.eData.HSourceBillNo,
|
"HSourceBillType": this.eData.HBillType
|
},
|
success: (res) => {
|
// console.log(1,res.data);
|
if(res.data.code == 1){
|
var data = res.data.data.h_p_JIT_GetInfoByICMOStatusInterID[0]
|
this.hform.HProcID = data.HProcID //当前工序ID
|
this.hform.HProcName = data.HProcName //当前工序
|
this.hform.HMaterID = data.HMaterID //产品ID
|
this.hform.HMaterNumber = data.HMaterNumber //产品代码
|
this.hform.HMaterName = data.HMaterName//产品名称
|
this.hform.HSourceID = data.HSourceID//生产资源ID
|
this.hform.HSourceName = data.HSourceName //生产资源
|
this.hform.HSourceBillNo = data.HICMOBillNo //源单单号(暂时取值订单编号)
|
this.hform.HSourceInterID = data.HSourceInterID //源单主内码(取值HInterID)
|
this.hform.HSourceEntryID = data.HSourceEntryID //源单子内码(源单行号)
|
this.hform.HSourceBillType = data.HSourceBillType //源单类型
|
this.hform.HDeptID = data.HDeptID //车间ID
|
this.hform.HDeptName = data.HDeptName //车间
|
this.hform.HICMOInterID = data.HICMOInterID //生产订单ID
|
this.hform.HICMOEntryID = data.HICMOEntryID //生产订单子ID
|
this.hform.HICMOBillNo = data.HICMOBillNo //生产订单
|
this.hform.HWorkBeginDate = data.HBeginDate //开工时间
|
this.hform.HPlanQty = data.HDatePlanQty //计划数量
|
}else{
|
uni.showToast({
|
title:'获取表单回填失败',
|
icon:'none'
|
})
|
}
|
|
uni.hideLoading()
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title:'获取表单回填接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
//新增
|
getNewData(){
|
uni.request({
|
url: this.serverUrl + '/Web/GetMAXNum',
|
data: { HBillType: '3724' },
|
success: (res) => {
|
// console.log(res.data)
|
if(res.data.count == 1){
|
this.hform.HInterID = 0
|
this.hform.HBillNo = res.data.data[0].HBillNo
|
}else{
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
//通过登录用户获取默认值
|
getDefValByUser(){
|
uni.request({
|
url: this.serverUrl + '/Cj_StationInBill/GetDefValByUser',
|
type: "GET",
|
async: false,
|
data: { "Czybm": this.userInfo.Czybm, "Czymc": this.userInfo.Czymc },
|
success: (res) => {
|
// console.log(res.data)
|
if(res.data.count == 1){
|
var data = res.data.data[0]
|
this.hform.HGroupID = data.HGroupID
|
this.hform.HGroupName = data.生产班组名称
|
this.hform.HEmpID = data.HEmpID
|
this.hform.HEmpName = data.操作员名称
|
}else{
|
uni.showToast({
|
title:'获取生产班组信息失败',
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'获取生产班组信息失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
submit() {
|
if(!this.hform.HEmpID){
|
uni.showToast({
|
title:'操作员不能为空!',
|
icon:'none'
|
})
|
}else if(!this.hform.HGroupID){
|
uni.showToast({
|
title:'班组不能为空!',
|
icon:'none'
|
})
|
// }else if(!this.hform.HDeptID){
|
// uni.showToast({
|
// title:'车间不能为空!',
|
// icon:'none'
|
// })
|
}else{
|
uni.showLoading({
|
title:'请稍候'
|
})
|
// var ModRightNameAdd = 'Gy_MouldFile_Edit';
|
// if(this.isEdit){
|
// this.hform.HUpDater = uni.getStorageSync('HUserName');//修改人
|
// var sMainStr = JSON.stringify(this.hform);
|
// var sMainSub = sMainStr + ";" + ModRightNameAdd + ";" + uni.getStorageSync('HUserName');
|
// var urls = '/Gy_EquipFileMain/EditBill'
|
// }else{
|
// this.hform.HMaker = uni.getStorageSync('HUserName');//制单人
|
// var sMainStr = JSON.stringify(this.hform);
|
// var sMainSub = sMainStr + ";" + ModRightNameAdd + ";" + uni.getStorageSync('HUserName');
|
// var urls = '/Gy_EquipFileMain/AddBill'
|
// }
|
var sMainStr = JSON.stringify(this.hform);
|
var sMainSub = sMainStr + ";Add"
|
console.log(sMainSub);
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/SaveGetMESProductReportFrom',
|
method:'POST',
|
dataType:"json",
|
data:{ msg: sMainSub },
|
success: (res) => {
|
console.log(1,res);
|
uni.hideLoading()
|
if(res.data.count == 1){
|
if (res.data.Verify == "Y"){ //自动审核
|
this.SaveVerify(res.data.HInterID) //审核
|
}else {
|
let pages = getCurrentPages();
|
let prePage = pages[pages.length - 2];
|
prePage.$vm.getList(this.hform.HSourceID)
|
setTimeout(()=>{
|
uni.navigateBack()
|
},1000)
|
}
|
}
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
}
|
},
|
SaveVerify(HInterID){
|
var datas={
|
HSourceID:this.hform.HSourceID,
|
HSourceInterID:this.hform.HSourceInterID,
|
HSourceEntryID:this.hform.HSourceEntryID,
|
HSourceBillNo:this.hform.HSourceBillNo,
|
HICMOInterID:this.hform.HICMOInterID,
|
HICMOEntryID:this.hform.HICMOEntryID,
|
HInterID:HInterID,
|
IsAudit:0,
|
CurUserName:getUserInfo().Czymc
|
}
|
console.log(datas)
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/MESProductAuditProcessReportList',
|
method:'GET',
|
dataType:"json",
|
async: true,
|
data:datas,
|
success: (res) => {
|
console.log(1,res);
|
uni.hideLoading()
|
if(res.data.count == 1){
|
let pages = getCurrentPages();
|
let prePage = pages[pages.length - 2];
|
prePage.$vm.getList(this.hform.HSourceID)
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}else{
|
let pages = getCurrentPages();
|
let prePage = pages[pages.length - 2];
|
prePage.$vm.getList(this.hform.HSourceID)
|
uni.showToast({
|
title:'自动审核失败',
|
icon:'none'
|
})
|
}
|
setTimeout(()=>{
|
uni.navigateBack()
|
},1000)
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
goBack(){
|
uni.navigateBack()
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.form{
|
width: 668rpx;
|
margin: 20rpx auto;
|
padding-bottom: 240rpx;
|
}
|
.tab_area{
|
width: 100%;
|
height: 50rpx;
|
}
|
.form-item{
|
display: flex;
|
align-items: center;
|
font-size: 30rpx;
|
padding: 6rpx 0;
|
.title{
|
width: 208rpx;
|
text{
|
color: red;
|
font-weight: bold;
|
}
|
}
|
.right{
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
}
|
.righton{
|
width: 450rpx;
|
border-radius: 22rpx;
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
input{
|
width: 100%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
textarea{
|
width: 98%;
|
padding: 8rpx 20rpx;
|
font-size: 30rpx;
|
}
|
|
}
|
.bottom-btn{
|
width: 100%;
|
// height: 120rpx;
|
position: fixed;
|
bottom: 0;
|
left: 0;
|
background-color: #fff;
|
box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
|
padding: 30rpx 40rpx 40rpx 40rpx;
|
button{
|
border-radius: 50rpx;
|
width: 180rpx;
|
height: 66rpx;
|
line-height: 66rpx;
|
font-size: 28rpx;
|
}
|
.btn-a{
|
background-color: #3A78FF;
|
color: #fff;
|
}
|
.btn-b{
|
background-color: #41a863;
|
color: #fff;
|
margin-left: 30rpx;
|
}
|
.btn-c{
|
background-color: #acacac;
|
color: #fff;
|
position: absolute;
|
right: 120rpx;
|
}
|
}
|
</style>
|