You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
819 lines
31 KiB
819 lines
31 KiB
<template>
|
|
<div class="page-box recycledAdjustmentPage" v-loading="Loading.appMainLoading">
|
|
<!-- <tablePagination
|
|
:currenButtonData="currenButtonData"
|
|
:tableData="tableData"
|
|
:tableLoading="Loading.tableLoading"
|
|
:tableColumns="tableColumns"
|
|
@rowDrop="rowDrop"
|
|
:totalCount="totalCount"
|
|
:multipleSelection="multipleSelection"
|
|
:MaxResultCount="PageListParams.MaxResultCount"
|
|
@topbutton="topbuttonHandle"
|
|
@inlineDialog="inlineDialog"
|
|
@sortChange="sortChange"
|
|
@alertoldSkipCount="alertoldSkipCount"
|
|
@alterResultCount="alterResultCount"
|
|
@handleSelectionChange="handleSelectionChange"
|
|
:currentPageProps="oldSkipCount"
|
|
:quicklySearchOption="quicklySearchOption"
|
|
@quicklySearchClick="quicklySearchClick"
|
|
@quicklySearchClear="quicklySearchClear"
|
|
:primarySearchOption="primarySearchOption"
|
|
@overallSearchFormClick="overallSearchFormClick"
|
|
:httpOverallSearchData="httpOverallSearchData"
|
|
>
|
|
</tablePagination> -->
|
|
<!-- 新导入 disabledMethod 导入方式禁用 disabledIsAllowPartImport 是否局部导入禁用-->
|
|
<!-- methodValue 导入方式默认选项 是否局部导入 默认选项 -->
|
|
<!-- <importFile
|
|
:loading="Loading.importLoading"
|
|
:show="displayDialog.importDialog"
|
|
:URL="URL"
|
|
:disabledMethod="{ method1: false, method2: false, method3: false }"
|
|
:disabledIsAllowPartImport="{ isAllowPartImport1: false, isAllowPartImport2: false, }"
|
|
isAllowPartImportValue="1"
|
|
@importClick="postImportMergeClick(arguments)"
|
|
@postImportDown="importDown"
|
|
></importFile> -->
|
|
<!-- <curren-Drawer
|
|
:title="tableColumns"
|
|
:DrawerLoading="Loading.DrawerLoading"
|
|
:drawer="displayDialog.detailsDialog"
|
|
:propsData="propsData"
|
|
:Butttondata="DrawerButtonData"
|
|
:tabsDesTions="tabsDesTions"
|
|
@drawerShut="(val) => (displayDialog.detailsDialog = val)"
|
|
@close-value="closeValue"
|
|
@drawerbutton="drawerbutton"
|
|
:tableColumns="detailsTableColumns"
|
|
:totalCount="totalCountDetails"
|
|
:MaxResultCount="MaxResultCountDetails"
|
|
@alterResultCountDetails="alterResultCountDetails"
|
|
@alertoldSkipCountDetails="alertoldSkipCountDetails"
|
|
></curren-Drawer> -->
|
|
<!-- 新增弹窗 -->
|
|
<el-dialog
|
|
:visible="addPopShow"
|
|
:modal-append-to-body="false"
|
|
:append-to-body="false"
|
|
:modal="false"
|
|
:fullscreen="true">
|
|
<div class="addPopMain">
|
|
<div class="addPopContent addPopContent_FS">
|
|
<span class="addPopTypeTitle">粉碎料</span>
|
|
<currenTableFlex
|
|
:flexTableData="addPopData_FS"
|
|
:flexSearchOptions="editOptions"
|
|
:flexTableColumns="addPopColumns_FS"
|
|
@detailsDataPush="pushFS"
|
|
@clearHandle="clearHandle_FS"
|
|
></currenTableFlex>
|
|
</div>
|
|
<div class="addPopContent addPopContent_YL">
|
|
<span class="addPopTypeTitle">原料</span>
|
|
<currenTableFlex
|
|
:flexTableData="addPopData_YL"
|
|
:flexSearchOptions="editOptions"
|
|
:flexTableColumns="addPopColumns_YL"
|
|
@detailsDataPush="pushYL"
|
|
@clearHandle="clearHandle_YL"
|
|
></currenTableFlex>
|
|
</div>
|
|
<div class="addPopContent addPopContent_HB">
|
|
<span class="addPopTypeTitle">混拌料</span>
|
|
<currenTableFlex
|
|
:flexTableData="addPopData_HB"
|
|
:flexSearchOptions="editOptions"
|
|
:flexTableColumns="addPopColumns_HB"
|
|
:showAddBtn="false"
|
|
:showAllDeleteButton="false"
|
|
@detailsDataPush="pushHB"
|
|
@clearHandle="clearHandle_HB"
|
|
></currenTableFlex>
|
|
</div>
|
|
</div>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button @click="addPopResetHandle">重 置</el-button>
|
|
<el-button type="primary" @click="addPopSureHandle">提 交</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import { tableMixins } from "@/mixins/TableMixins"
|
|
import { LoadingMixins } from "@/mixins/LoadingMixins"
|
|
import { drawerMixins } from "@/mixins/drawerMixins"
|
|
import { TableHeaderMixins } from "@/mixins/TableHeaderMixins"
|
|
import { mixins } from "@/mixins/mixins"
|
|
import { requestData } from "@/utils/processButtonData"
|
|
import currenTableFlex from "@/components/currenTableFlex"
|
|
import { filterSelectMixins } from '@/mixins/filter-Select'
|
|
import detailsRules from '@/utils/rules';
|
|
import { getPageList,itemTransformNewCreate } from "@/api/wms-api"
|
|
import { postInventoryLabelCode_count } from "@/api/wms-core"
|
|
import { getNowToT,formatTimeStampToNorm } from '@/utils/formatTime'
|
|
import {initPrintPackingCodeData } from "@/mixins/printMixin"
|
|
import store from '@/store'
|
|
export default {
|
|
name: "materialsAdjustmentFunc",
|
|
mixins: [
|
|
tableMixins,
|
|
LoadingMixins,
|
|
drawerMixins,
|
|
TableHeaderMixins,
|
|
mixins,
|
|
filterSelectMixins,
|
|
],
|
|
components:{
|
|
currenTableFlex
|
|
},
|
|
data () {
|
|
return {
|
|
URL: 'wms/store/item-transform-request',
|
|
//常用按钮数据
|
|
currenButtonData: [
|
|
this.defaultAddBtn(),//新增
|
|
this.defaultImportBtn(),//导入
|
|
this.defaultFieldSettingBtn(),//字段设置
|
|
this.defaultFreshBtn(),//刷新
|
|
this.defaultFilterBtn(),//筛选
|
|
],
|
|
DrawerButtonData: requestData(this),
|
|
addPopShow:true,//新增弹窗显隐
|
|
//粉碎料信息
|
|
addPopData_FS:[{
|
|
itemCode:null,
|
|
supplierCode:null,
|
|
poNumber:null,
|
|
qty:null,
|
|
locationCode:null,
|
|
}],
|
|
//粉碎料表头信息
|
|
addPopColumns_FS:[
|
|
{ type: "filterSelect", label: "物品代码", prop: "itemCode", optionsLabel: "name", optionsValue: "code",
|
|
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Item-Basic",
|
|
this.isFilter("isRecycled","true"),1000
|
|
)},
|
|
// searchButton: (val) => { this.showSerarchPage(val, 'basedata/Item-Basic', 'ItemBasic', '物品选择', this.addPopData_HB) },
|
|
width:"auto"
|
|
},
|
|
{
|
|
type: "filterSelect", label: "供应商代码", prop: "supplierCode", optionsLabel: "supplierSimpleName", optionsValue: "supplierCode", clearable:true,
|
|
beforeFocus:(tableScope)=>{if(!this.addPopData_FS[tableScope.$index].itemCode || this.addPopData_FS[tableScope.$index].length <= 0){this.$message.error('请选择物品代码'); return false}else{return true}},
|
|
focus: (type,val,tableScope) => { return this.getFilterList(type, val, "basedata/supplier-item",this.isFilter("itemCode", this.addPopData_FS[tableScope.$index].itemCode),1000)},
|
|
width:"auto",
|
|
},
|
|
{
|
|
type: "filterSelect", label: "采购订单号", prop: "poNumber",optionsValue: "poNumber", clearable:true,
|
|
beforeFocus:(tableScope)=>{if(!this.addPopData_FS[tableScope.$index].itemCode || this.addPopData_FS[tableScope.$index].itemCode.length <= 0 || !this.addPopData_FS[tableScope.$index].supplierCode || this.addPopData_FS[tableScope.$index].supplierCode.length <= 0){this.$message.error('请选择物品代码和供应商代码'); return false}else{return true}},
|
|
focus: (type,val,tableScope) => { return this.getFilterList(type, val, "wms/store/supplier-asn",this.isFilter("supplierCode", this.addPopData_FS[tableScope.$index].supplierCode),1000)},
|
|
width:"auto",
|
|
},
|
|
{ type: "filterSelect", label: "目标库位", prop: "locationCode", optionsLabel: "name", optionsValue: "code",
|
|
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Location",this.isFilter("type", "2"),1000)},
|
|
// searchButton: (val) => { this.showSerarchPage(val, 'basedata/Location', 'InventoryBalance', '库位选择', this.addPopData_HB) },
|
|
width:"auto"
|
|
},
|
|
{ type: "input", validType:'pointNumber', label: "数量", prop: "qty", width:"auto",
|
|
rules: [{
|
|
type: "number",
|
|
trigger: ["blur"],
|
|
validator: (rule, value, callback) => {
|
|
let _index = rule.field.slice(8,9)
|
|
let _qty = Number(this.addPopData_FS[_index].qty)
|
|
if(_qty <= 0){
|
|
return callback(new Error('数量必须大于0'))
|
|
}else{
|
|
callback()
|
|
}
|
|
}
|
|
}]
|
|
},
|
|
],
|
|
//原料信息
|
|
addPopData_YL:[{
|
|
itemCode:null,
|
|
packingCode:null,
|
|
inventoryQty:null,
|
|
locationCode:null,
|
|
qty:null
|
|
}],
|
|
//原料表头信息
|
|
addPopColumns_YL:[
|
|
{ type: "filterSelect", label: "物品代码", prop: "itemCode", optionsLabel: "name", optionsValue: "code",
|
|
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Item-Basic",this.isFilter("type", "10C02"),1000)},
|
|
width:"auto"
|
|
},
|
|
{ type: "filterSelect", label: "箱标签", prop: "packingCode", optionsLabel: "packingCode", optionsValue: "packingCode", clearable:true,
|
|
beforeFocus:(tableScope)=>{if(!this.addPopData_YL[tableScope.$index].itemCode || this.addPopData_YL[tableScope.$index].length <= 0){this.$message.error('请选择物品代码'); return false}else{return true}},
|
|
focus: (type,val,tableScope) => { return this.getFilterList(type, val, "wms/inventory/Inventory-Balance",this.isFilter("itemCode", this.addPopData_YL[tableScope.$index].itemCode),1000)},
|
|
width:"auto",
|
|
},
|
|
// 库存数量、库位:自动带出
|
|
{ label: "库存数量", prop: "inventoryQty", width:"auto" },
|
|
{ label: "库位", prop: "locationCode", width:"auto" },
|
|
// 小于等于库存数量
|
|
{ type: "input", validType:'pointNumber', label: "数量", prop: "qty", width:"auto",
|
|
rules: [{
|
|
type: "number",
|
|
trigger: ["blur"],
|
|
validator: (rule, value, callback) => {
|
|
let _index = rule.field.slice(8,9)
|
|
if(this.addPopData_YL[_index].qty == null){
|
|
return callback(new Error('数量不能为空'))
|
|
}
|
|
let _qty = Number(this.addPopData_YL[_index].qty)
|
|
let _invenQty = Number(this.addPopData_YL[_index].inventoryQty)
|
|
if(_qty <= 0 || _qty > _invenQty){
|
|
return callback(new Error('数量必须大于0,且不大于库存数量'))
|
|
}else{
|
|
callback()
|
|
}
|
|
}
|
|
}]
|
|
},
|
|
],
|
|
//混拌料信息
|
|
addPopData_HB:[{
|
|
itemCode:null,
|
|
supplierCode:null,
|
|
poNumber:null,
|
|
qty:null,
|
|
locationCode:null,
|
|
}],
|
|
//混拌料表头信息
|
|
addPopColumns_HB:[
|
|
{ type: "filterSelect", label: "物品代码", prop: "itemCode", optionsLabel: "name", optionsValue: "code",
|
|
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Item-Basic",this.isFilter("isRecycled","false"),1000)},
|
|
// searchButton: (val) => { this.showSerarchPage(val, 'basedata/Item-Basic', 'ItemBasic', '物品选择', this.addPopData_HB) },
|
|
width:"auto",
|
|
},
|
|
{
|
|
type: "filterSelect", label: "供应商代码", prop: "supplierCode", optionsLabel: "supplierSimpleName", optionsValue: "supplierCode", clearable:true,
|
|
beforeFocus:(tableScope)=>{if(!this.addPopData_HB[tableScope.$index].itemCode || this.addPopData_HB[tableScope.$index].length <= 0){this.$message.error('请选择物品代码'); return false}else{return true}},
|
|
focus: (type,val,tableScope) => { return this.getFilterList(type, val, "basedata/supplier-item",this.isFilter("itemCode", this.addPopData_HB[tableScope.$index].itemCode),1000)},
|
|
width:"auto",
|
|
},
|
|
{
|
|
type: "filterSelect", label: "采购订单号", prop: "poNumber",optionsValue: "poNumber", clearable:true,
|
|
beforeFocus:(tableScope)=>{if(!this.addPopData_HB[tableScope.$index].itemCode || this.addPopData_HB[tableScope.$index].itemCode.length <= 0 || !this.addPopData_HB[tableScope.$index].supplierCode || this.addPopData_HB[tableScope.$index].supplierCode.length <= 0){this.$message.error('请选择物品代码和供应商代码'); return false}else{return true}},
|
|
focus: (type,val,tableScope) => { return this.getFilterList(type, val, "wms/store/supplier-asn",this.isFilter("supplierCode", this.addPopData_HB[tableScope.$index].supplierCode),1000)},
|
|
width:"auto",
|
|
},
|
|
{ type: "filterSelect", label: "目标库位", prop: "locationCode", optionsLabel: "name", optionsValue: "code",
|
|
focus: (type,val) => { return this.getFilterList(type, val, "basedata/Location",false,1000)},
|
|
// searchButton: (val) => { this.showSerarchPage(val, 'basedata/Location', 'InventoryBalance', '库位选择', this.addPopData_HB) },
|
|
width:"auto"
|
|
},
|
|
{ type: "input", validType:'pointNumber', label: "数量", prop: "qty", width:"auto",
|
|
rules: [{
|
|
type: "number",
|
|
trigger: ["blur"],
|
|
validator: (rule, value, callback) => {
|
|
let _index = rule.field.slice(8,9)
|
|
let _qty = Number(this.addPopData_HB[_index].qty)
|
|
if(_qty <= 0){
|
|
return callback(new Error('数量必须大于0'))
|
|
}else{
|
|
callback()
|
|
}
|
|
}
|
|
}]
|
|
},
|
|
],
|
|
itemStagingLists:{},//物料相关内容暂存
|
|
supplierStagingLists:{},// 供应商信息暂存
|
|
asnStagingLists:{},// 供应商发货通知暂存
|
|
locationStagingLists:{},//库位相关内容暂存
|
|
packingStagingLists:{},//箱码相关内容暂存
|
|
needNewPackingList:[],//需要生成项目的列表信息(N个粉碎料+1个混拌料)
|
|
newPackArr:[],//已生成的新箱码
|
|
};
|
|
},
|
|
mounted () {
|
|
// this.paging();
|
|
},
|
|
methods:{
|
|
// 混拌料物品筛选,不可选粉碎料选过的
|
|
// isFilterForHB(){
|
|
// let _items = []
|
|
// this.addPopData_FS.forEach(item=>{
|
|
// if(item.itemCode)_items.push(item.itemCode)
|
|
// })
|
|
// if(_items.length <= 0){
|
|
// return []
|
|
// }
|
|
// let filter = [
|
|
// {
|
|
// logic: "And",
|
|
// column: 'code',
|
|
// action: "NotIn",
|
|
// value: JSON.stringify(_items)
|
|
// }
|
|
// ]
|
|
// return filter
|
|
// },
|
|
//过滤查询条件
|
|
isFilter (val, data) {
|
|
let filter = [
|
|
{
|
|
logic: "And",
|
|
column: val,
|
|
action: "==",
|
|
value: data
|
|
}
|
|
]
|
|
return filter
|
|
},
|
|
topbuttonHandle(val){
|
|
if(val == 'newly'){
|
|
}else{
|
|
this.topbutton(val)
|
|
}
|
|
},
|
|
// 初始化数据
|
|
initAddPopData(){
|
|
this.addPopData_FS=[{
|
|
itemCode:null,
|
|
supplierCode:null,
|
|
poNumber:null,
|
|
qty:null,
|
|
locationCode:null,
|
|
}]
|
|
this.addPopData_YL=[{
|
|
itemCode:null,
|
|
packingCode:null,
|
|
inventoryQty:null,
|
|
locationCode:null,
|
|
qty:null
|
|
}]
|
|
this.addPopData_HB=[{
|
|
itemCode:null,
|
|
supplierCode:null,
|
|
poNumber:null,
|
|
qty:null,
|
|
locationCode:null,
|
|
}]
|
|
},
|
|
// 重置
|
|
addPopResetHandle(){
|
|
this.$confirm('重置后,字段设置将恢复初始设置,是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
}).then(() => {
|
|
this.initAddPopData()
|
|
}).catch(() => {
|
|
|
|
});
|
|
},
|
|
// 最后提交的from值转义
|
|
getFormDataInit(item,index,prop,prop_yl){
|
|
let _prop_yl = prop_yl ? prop_yl : prop;
|
|
return item.remark == '原料' ? this.packingStagingLists[item.packingCode][_prop_yl] : this.newPackArr[index][prop]
|
|
},
|
|
// 最后提交接口
|
|
lastCommitHttp(){
|
|
this.addPopData_YL.forEach(item=>{
|
|
item.remark = '原料'
|
|
})
|
|
let _allDetails = [
|
|
...this.addPopData_FS,
|
|
...this.addPopData_YL
|
|
]
|
|
let _toData = this.addPopData_HB[0]
|
|
let _toItemInfo = this.itemStagingLists[_toData.itemCode]
|
|
let _toLocationInfo = this.locationStagingLists[_toData.locationCode]
|
|
let _toData_new = this.newPackArr[this.newPackArr.length - 1]
|
|
let _details = []
|
|
let _this = this
|
|
_allDetails.forEach((item,index)=>{
|
|
let _itemInfo = this.itemStagingLists[item.itemCode]
|
|
let _locationInfo = this.locationStagingLists[item.locationCode]
|
|
let _item = {
|
|
remark: item.remark || null,
|
|
itemCode: item.itemCode || null,
|
|
itemName: _itemInfo.name || null,
|
|
itemDesc1: _itemInfo.desc1 || null,
|
|
itemDesc2: _itemInfo.desc2 || null,
|
|
fromPackingCode: item.packingCode ? item.packingCode : this.newPackArr[index].code,
|
|
toPackingCode: _toData_new.code,
|
|
toItemCode: _toData.itemCode || null,
|
|
toItemName: _toItemInfo.name || null,
|
|
toItemDesc1: _toItemInfo.desc1 || null,
|
|
toItemDesc2: _toItemInfo.desc2 || null,
|
|
uom: _itemInfo.basicUom || null,
|
|
fromQty: item.qty,
|
|
toQty: _toData.qty,
|
|
// 原料的走本身
|
|
fromSupplierBatch: this.getFormDataInit(item,index,'supplierBatch'),
|
|
fromArriveDate: this.getFormDataInit(item,index,'arriveDate'),
|
|
fromProduceDate: this.getFormDataInit(item,index,'produceDate'),
|
|
fromExpireDate: this.getFormDataInit(item,index,'expireDate'),
|
|
fromLot: this.getFormDataInit(item,index,'lot'),
|
|
fromStatus: this.getFormDataInit(item,index,'labelStatus','status'),
|
|
fromLocationCode: item.locationCode || null,
|
|
fromLocationArea: _locationInfo.areaCode || null,
|
|
fromLocationGroup: _locationInfo.locationGroupCode || null,
|
|
fromLocationErpCode: _locationInfo.erpLocationCode || null,
|
|
fromWarehouseCode: _locationInfo.warehouseCode || null,
|
|
fromContainerCode: this.getFormDataInit(item,index,'containerCode'),
|
|
toSupplierBatch: _toData_new.supplierBatch || null,
|
|
toArriveDate: _toData_new.arriveDate || null,
|
|
toProduceDate: _toData_new.produceDate || null,
|
|
toExpireDate: _toData_new.expireDate || null,
|
|
toLot: _toData_new.lot || null,
|
|
toStatus: 1,
|
|
toLocationCode: _toData.locationCode || null,
|
|
toLocationArea: _toLocationInfo.areaCode || null,
|
|
toLocationGroup: _toLocationInfo.locationGroupCode || null,
|
|
toLocationErpCode: _toLocationInfo.erpLocationCode || null,
|
|
toWarehouseCode: _toLocationInfo.warehouseCode || null,
|
|
toContainerCode: _toData_new.containerCode || null,
|
|
worker: store.getters.name.userName,
|
|
reasonCode: null,
|
|
}
|
|
_details.push(_item)
|
|
})
|
|
|
|
let _recDetail= []
|
|
this.addPopData_FS.forEach((item,index)=>{
|
|
let _itemInfoFS = this.itemStagingLists[item.itemCode]
|
|
let _locationInfoFS = this.locationStagingLists[item.locationCode]
|
|
let _item = {
|
|
remark: null,
|
|
itemCode: _itemInfoFS.code || null,
|
|
itemName: _itemInfoFS.name || null,
|
|
itemDesc1: _itemInfoFS.desc1 || null,
|
|
itemDesc2: _itemInfoFS.desc2 || null,
|
|
lot: this.newPackArr[index].lot || null,
|
|
supplierBatch: this.newPackArr[index].supplierBatch || null,
|
|
arriveDate: this.newPackArr[index].arriveDate || null,
|
|
produceDate: this.newPackArr[index].produceDate || null,
|
|
expireDate: this.newPackArr[index].expireDate || null,
|
|
packingCode: this.newPackArr[index].code,
|
|
containerCode: this.newPackArr[index].containerCode || null,
|
|
uom: _itemInfoFS.basicUom || null,
|
|
qty: item.qty,
|
|
stdPackQty: Number(_itemInfoFS.stdPackQty) || 0,
|
|
locationCode: item.locationCode || null,
|
|
locationArea: _locationInfoFS.areaCode || null,
|
|
locationGroup: _locationInfoFS.locationGroupCode || null,
|
|
locationErpCode: _locationInfoFS.erpLocationCode || null,
|
|
status: 1,
|
|
warehouseCode: _locationInfoFS.warehouseCode || null,
|
|
reasonCode: null,
|
|
}
|
|
_recDetail.push(_item)
|
|
})
|
|
let _finalData = {
|
|
tenantId: null,
|
|
remark: "",
|
|
extraProperties: null,
|
|
worker: store.getters.name.userName,
|
|
activeDate: getNowToT(),
|
|
number: "",
|
|
requestNumber: "",
|
|
jobNumber: "",
|
|
details:_details,
|
|
recDetails:_recDetail
|
|
}
|
|
|
|
itemTransformNewCreate(_finalData)
|
|
.then(item=>{
|
|
this.Loading.appMainLoading = false
|
|
// 提示是否打印箱码,之后在清除数据
|
|
this.$confirm('提交成功, 是否需要打印箱标签?', '提示', {
|
|
confirmButtonText: '打印',
|
|
cancelButtonText: '关闭',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
let _HBPack = this.newPackArr[this.newPackArr.length - 1]
|
|
let _printData = {
|
|
supplierSimpleName:_HBPack.supplierSimpleName || "",
|
|
supplierCode:_HBPack.supplierCode || "",
|
|
contacts:_HBPack.contacts || "",
|
|
customerAddressCode:_HBPack.customerAddressCode || "",
|
|
remark:_HBPack.remark || "",
|
|
planArriveDate:_HBPack.planArriveDate || "",
|
|
poNumber:_HBPack.poNumber || "",
|
|
asnNumber:_HBPack.asnNumber || "",
|
|
details:[],
|
|
}
|
|
_HBPack.packingCode = _HBPack.code
|
|
_printData.details.push(_HBPack)
|
|
let _data = initPrintPackingCodeData(_printData);
|
|
this.Loading.appMainLoading = true
|
|
this.Print(_data)
|
|
.then(data=>{
|
|
this.initAddPopData()
|
|
this.Loading.appMainLoading = false
|
|
})
|
|
.catch(err=>{
|
|
this.$errorMsg(`打印失败,可去标签查询中重新打印,箱标签为${_HBPack.packingCode}`)
|
|
this.initAddPopData()
|
|
this.Loading.appMainLoading = false
|
|
})
|
|
}).catch(() => {
|
|
this.initAddPopData()
|
|
});
|
|
})
|
|
.catch(err=>{
|
|
this.$errorMsg("提交失败!请重试")
|
|
this.Loading.appMainLoading = false
|
|
})
|
|
},
|
|
//递归生成箱码部分
|
|
async resendHandle(index){
|
|
this.Loading.appMainLoading = true
|
|
if(index >= this.needNewPackingList.length){
|
|
// 箱码全部生成进行提交
|
|
this.lastCommitHttp()
|
|
return
|
|
}
|
|
let _resultBack = await this.createNewPack(index)
|
|
//如果成功了,继续发送
|
|
if(_resultBack == 1){
|
|
let _index = Number(index) + 1
|
|
this.resendHandle(_index)
|
|
}
|
|
//失败了提示不进行任何处理
|
|
else{
|
|
this.Loading.appMainLoading = false
|
|
this.$errorMsg(`创建箱码失败,请重新提交`)
|
|
}
|
|
},
|
|
// 生成新箱码
|
|
async createNewPack(index){
|
|
let _item = this.needNewPackingList[index]
|
|
let _item_info = this.itemStagingLists[_item.itemCode]
|
|
let _location_info = this.locationStagingLists[_item.locationCode]
|
|
let _supplier_info = this.supplierStagingLists[_item.supplierCode]
|
|
let _asn_info = this.asnStagingLists[_item.poNumber]
|
|
let _creatPackData = {
|
|
itemCode: _item_info.code || null,
|
|
itemName: _item_info.name || null,
|
|
itemDesc1: _item_info.desc1 || null,
|
|
itemDesc2: _item_info.desc2 || null,
|
|
lot: formatTimeStampToNorm(new Date(),'date').replaceAll("-",""),
|
|
arriveDate: getNowToT(),
|
|
produceDate: getNowToT(),
|
|
expireDate: "9999-12-31",
|
|
stdPackQty: Number(_item_info.stdPackQty) || 0,
|
|
uom: _item_info.basicUom || null,
|
|
qty: Number(_item.qty),
|
|
labelStatus: 1,
|
|
recommendLocationCode: _location_info.code || null,
|
|
locationErpCode: _location_info.erpLocationCode || null,
|
|
containerCode: null,
|
|
supplierCode: _item.supplierCode,
|
|
poNumber: _item.poNumber,
|
|
rpNumber: _asn_info.rpNumber,
|
|
asnNumber: _asn_info.number,
|
|
qLevel: _item_info.elevel || null,
|
|
qualityFile: null,
|
|
prodLine: null,
|
|
team: null,
|
|
shift: null,
|
|
specifications: null,
|
|
supplierBatch: null,
|
|
supplierName: null,
|
|
supplierSimpleName: _supplier_info.supplierSimpleName,
|
|
supplierItemCode: _supplier_info.supplierItemCode,
|
|
supplierItemName: _supplier_info.itemName,
|
|
labelType: 1,//采购标签
|
|
planArriveDate: "9999-12-31",
|
|
remark:null,
|
|
}
|
|
let resultBack = null
|
|
// // 生成标签(接口)
|
|
await postInventoryLabelCode_count({count:1}, _creatPackData)
|
|
.then(res=>{ resultBack = 1;this.newPackArr[index] = res[0] })
|
|
.catch(err=>{ resultBack = 0 })
|
|
|
|
return resultBack
|
|
},
|
|
// 提交
|
|
addPopSureHandle(){
|
|
|
|
// 验证【粉碎料】信息是否填全
|
|
let _err_FS=0
|
|
this.addPopData_FS.forEach(item=>{
|
|
if(!item.itemCode || Number(item.qty <= 0) || !item.locationCode || !item.supplierCode || !item.poNumber){
|
|
_err_FS++
|
|
}
|
|
})
|
|
if(_err_FS > 0){
|
|
return this.$warningMsg("【粉碎料】信息未填全,请填写")
|
|
}
|
|
|
|
// 验证【原料】信息是否填全
|
|
let _err_YL=0
|
|
this.addPopData_YL.forEach(item=>{
|
|
if(!item.itemCode || Number(item.inventoryQty <= 0) || Number(item.qty <= 0) || !item.locationCode || !item.packingCode || item.packingCode.length <= 0){
|
|
_err_YL++
|
|
}
|
|
})
|
|
if(_err_YL > 0){
|
|
return this.$warningMsg("【原料】信息未填全,请填写")
|
|
}
|
|
|
|
// 验证 【原料】的数量是否符合要求
|
|
let notPass_YL = 0
|
|
this.addPopData_YL.forEach(item=>{
|
|
if(item.qty > item.inventoryQty){
|
|
notPass_YL++
|
|
}
|
|
})
|
|
if(notPass_YL > 0){
|
|
return this.$warningMsg("【原料】数量不可以大于库存数量,请更改")
|
|
}
|
|
|
|
// 验证【混拌料】信息是否填全
|
|
let _err_HB=0
|
|
this.addPopData_HB.forEach(item=>{
|
|
if(!item.itemCode || Number(item.qty <= 0) || !item.locationCode || !item.supplierCode || !item.poNumber){
|
|
_err_HB++
|
|
}
|
|
})
|
|
if(_err_HB > 0){
|
|
return this.$warningMsg("【混拌料】信息未填全,请填写")
|
|
}
|
|
|
|
// 验证混拌料的值,不可以大于粉碎料+原料
|
|
let _maxQty_HB = 0
|
|
this.addPopData_FS.forEach(item=>{ _maxQty_HB += Number(item.qty) })
|
|
this.addPopData_YL.forEach(item=>{ _maxQty_HB += Number(item.qty) })
|
|
if(Number(this.addPopData_HB[0].qty) > _maxQty_HB){
|
|
return this.$warningMsg(`【混拌料】数量,不可大于${_maxQty_HB} (粉碎料数量加原料数量的总和)`)
|
|
}
|
|
|
|
// 全部通过验证
|
|
// 创建【粉碎料】箱码
|
|
// 先生成箱码
|
|
let _new_FS = {}
|
|
this.needNewPackingList = [
|
|
...this.addPopData_FS,
|
|
...this.addPopData_HB
|
|
]
|
|
this.resendHandle(0)
|
|
console.log('粉碎料',this.addPopData_FS)
|
|
console.log('原料',this.addPopData_YL)
|
|
console.log('混拌料',this.addPopData_HB)
|
|
},
|
|
// 粉碎料下拉
|
|
pushFS(data){
|
|
if(data[1].prop == "itemCode"){
|
|
this.itemStagingLists[data[2]] = data[0]
|
|
// if(data[2] == this.addPopData_HB[0].itemCode){
|
|
// this.$warningMsg("不可选择与混拌料相同的物料")
|
|
// this.$nextTick(()=>{
|
|
// this.addPopData_FS[data[3].$index].itemCode = null
|
|
// })
|
|
// }
|
|
this.addPopData_FS[data[3].$index].supplierCode = null
|
|
this.addPopData_FS[data[3].$index].poNumber = null
|
|
this.addPopData_FS[data[3].$index].locationCode = null
|
|
}
|
|
if(data[1].prop == "supplierCode"){
|
|
this.supplierStagingLists[data[2]] = data[0]
|
|
}
|
|
if(data[1].prop == "poNumber"){
|
|
this.asnStagingLists[data[2]] = data[0]
|
|
}
|
|
if(data[1].prop == "locationCode"){
|
|
this.locationStagingLists[data[2]] = data[0]
|
|
}
|
|
},
|
|
// 粉碎料清空
|
|
clearHandle_FS(item,scope){
|
|
if(item.prop == "itemCode" || item.prop == "supplierCode"){
|
|
this.addPopData_FS[scope.$index].supplierCode = null
|
|
this.addPopData_FS[scope.$index].poNumber = null
|
|
}
|
|
},
|
|
// 原料下拉
|
|
pushYL(data){
|
|
if(data[1].prop=="itemCode"){
|
|
this.itemStagingLists[data[2]] = data[0]
|
|
}
|
|
else if(data[1].prop=="packingCode"){
|
|
this.packingStagingLists[data[2]] = data[0]
|
|
this.addPopData_YL[data[3].$index].packingCode = data[2]
|
|
this.addPopData_YL[data[3].$index].inventoryQty = data[0].qty
|
|
this.addPopData_YL[data[3].$index].locationCode = data[0].locationCode
|
|
this.addPopData_YL[data[3].$index].qty = null
|
|
// 获取库位相关信息
|
|
let params = {
|
|
Sorting: "",
|
|
MaxResultCount: 1000,
|
|
SkipCount: 0,
|
|
condition: {
|
|
filters: [{
|
|
logic: "And",
|
|
column: "code",
|
|
action: "==",
|
|
value: data[0].locationCode
|
|
}]
|
|
}
|
|
}
|
|
this.Loading.appMainLoading = true
|
|
getPageList(params, "basedata/Location").then((res)=>{
|
|
this.locationStagingLists[data[0].locationCode] = res.items[0]
|
|
this.Loading.appMainLoading = false
|
|
})
|
|
.catch(err=>{
|
|
this.Loading.appMainLoading = false
|
|
})
|
|
}
|
|
},
|
|
// 原料清空
|
|
clearHandle_YL(item,scope){
|
|
if(item.prop == "itemCode" || item.prop == "packingCode"){
|
|
this.addPopData_YL[scope.$index].packingCode = null
|
|
this.addPopData_YL[scope.$index].inventoryQty = null
|
|
this.addPopData_YL[scope.$index].locationCode = null
|
|
this.addPopData_YL[scope.$index].qty = null
|
|
}
|
|
},
|
|
// 混拌料下拉
|
|
pushHB(data){
|
|
if(data[1].prop == "itemCode"){
|
|
this.itemStagingLists[data[2]] = data[0]
|
|
this.addPopData_HB[data[3].$index].supplierCode = null
|
|
this.addPopData_HB[data[3].$index].poNumber = null
|
|
}
|
|
if(data[1].prop == "supplierCode"){
|
|
this.supplierStagingLists[data[2]] = data[0]
|
|
}
|
|
if(data[1].prop == "poNumber"){
|
|
this.asnStagingLists[data[2]] = data[0]
|
|
}
|
|
if(data[1].prop == "locationCode"){
|
|
this.locationStagingLists[data[2]] = data[0]
|
|
}
|
|
},
|
|
// 粉碎料清空
|
|
clearHandle_HB(item,scope){
|
|
if(item.prop == "itemCode" || item.prop == "supplierCode"){
|
|
this.addPopData_HB[scope.$index].supplierCode = null
|
|
this.addPopData_HB[scope.$index].poNumber = null
|
|
}
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
@import "../../../styles/mainbasicData.scss";
|
|
|
|
.addPopMain{
|
|
height:100%;
|
|
|
|
.addPopContent{
|
|
position:relative;
|
|
padding:0 20px;
|
|
|
|
.addPopTypeTitle{
|
|
position:absolute;
|
|
left:0;
|
|
top:10px;
|
|
border-left:#66b1ff solid 6px;
|
|
padding-left:10px;
|
|
height:28px;
|
|
line-height:28px;
|
|
overflow:hidden;
|
|
font-size:18px;
|
|
margin-left: 20px;
|
|
}
|
|
}
|
|
|
|
.addPopContent_FS{
|
|
height:calc(50% - 100px);
|
|
margin-bottom:10px;
|
|
}
|
|
|
|
.addPopContent_YL{
|
|
height: calc(50% - 70px);
|
|
padding: 15px 20px;
|
|
background: #d4e6fd;
|
|
}
|
|
|
|
.addPopContent_HB{
|
|
height:160px;
|
|
padding-top:28px
|
|
}
|
|
}
|
|
</style>
|
|
<style lang="scss" >
|
|
.recycledAdjustmentPage {
|
|
.el-dialog .el-dialog__body {
|
|
padding: 0 !important;
|
|
}
|
|
|
|
.el-form-item{
|
|
margin-bottom:0 !important
|
|
}
|
|
}
|
|
|
|
</style>
|