| | |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | <el-col :span="6"> |
| | | <el-form-item label="币别" prop="HCurName"> |
| | | <el-input v-model="form.HCurName" placeholder="请输入币别" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="汇率" prop="HExRate"> |
| | | <el-input v-model="form.HExRate" placeholder="请输入汇率" readonly /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | |
| | |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div class="form-group"> |
| | | <!-- <div class="form-group"> |
| | | <el-form-item label="附件" prop="fujian"> |
| | | <el-upload |
| | | class="upload-demo" |
| | | ref="upload" |
| | | action="" |
| | | :on-preview="handleFilePreview" |
| | | :on-remove="handleFileRemove" |
| | | :on-change="handleFileChange" |
| | | :file-list="fileList" |
| | | :auto-upload="false" |
| | | :limit="10" |
| | | :on-exceed="handleExceed" |
| | | <el-upload class="upload-demo" ref="upload" action="" :on-preview="handleFilePreview" |
| | | :on-remove="handleFileRemove" :on-change="handleFileChange" :file-list="fileList" |
| | | :auto-upload="false" :limit="10" :on-exceed="handleExceed" |
| | | accept=".jpg,.png,.jpeg,.pdf,.doc,.docx,.xls,.xlsx,.zip,.rar"> |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | | <div slot="tip" class="el-upload__tip">支持上传jpg/png/jpeg/pdf/doc/docx/xls/xlsx/zip/rar格式文件,最多10个</div> |
| | | <div slot="tip" class="el-upload__tip"> |
| | | 支持上传jpg/png/jpeg/pdf/doc/docx/xls/xlsx/zip/rar格式文件,最多10个</div> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </div> |
| | | </div> --> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="承运商信息" name="second"> |
| | | <div class="form-group"> |
| | |
| | | <el-col :span="6"> |
| | | <el-form-item label="运费" prop="HMoney"> |
| | | <el-input v-model="form.HMoney" placeholder="请输入运费" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="币别" prop="HCurName"> |
| | | <el-input v-model="form.HCurName" placeholder="请输入币别" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="汇率" prop="HExRate"> |
| | | <el-input v-model="form.HExRate" placeholder="请输入汇率" readonly /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | @selection-change="handleTableZbEdit" :row-class-name="rowSysZbIndex" show-summary border> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column align="center" label="序号" type="index" width="80" /> |
| | | <el-table-column align="center" label="源单单据号" width="120"> |
| | | <el-table-column align="center" label="发货通知单" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HSourceBillNo }}</span> |
| | | </template> |
| | |
| | | <el-table-column align="center" label="物料名称" width="120"> |
| | | <template slot-scope="scope">{{ scope.row.HMaterName }} </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="容器代码" width="120"> |
| | | <el-table-column align="center" label="物料规格" width="120"> |
| | | <template slot-scope="scope">{{ scope.row.HModel }} </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="false" align="center" label="容器代码" width="120"> |
| | | <template slot-scope="scope"> |
| | | <el-input v-model="scope.row.HMouldNumber" placeholder="请输入器具代码" |
| | | @keyup.native.f7="openDataDialog(17, scope.row)" |
| | | @dblclick.native="openDataDialog(17, scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="容器名称" width="120"> |
| | | <el-table-column v-if="false" align="center" label="容器名称" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HMouldName }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="容器数量/托" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HStandardQtyForMouldInPack }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | |
| | | @change="checkTotalQtyExceed(scope.row)"></el-input-number> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="标准包装数量" width="120"> |
| | | <el-table-column v-if="false" align="center" label="标准包装数量" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HSNP }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="包装容器数量" width="120"> |
| | | <el-table-column v-if="false" align="center" label="包装容器数量" width="170"> |
| | | <template slot-scope="scope"> |
| | | <el-input-number v-model="scope.row.HMouldQty" :min="0" style="width: 90px;" |
| | | <el-input-number v-model="scope.row.HMouldQty" :min="0" style="width: 150px;" |
| | | controls-position="right" |
| | | @change="changeHMouldQty(scope.row)"></el-input-number> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="托数" width="120"> |
| | | <el-table-column v-if="false" align="center" label="容器数量/托" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HStandardQtyForMouldInPack }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="false" align="center" label="托数" width="120"> |
| | | <template slot-scope="scope"> <!--HPackQTY=HMouldQty/HStandardQtyForMouldInPack --> |
| | | <el-input-number v-model="scope.row.HPackQTY" :min="0" style="width: 90px;" |
| | | controls-position="right" @change="changeHPackQty(scope.row)"></el-input-number> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="托单位体积" width="120"> |
| | | <el-table-column v-if="false" align="center" label="托单位体积" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HPackV }}</span> |
| | | </template> |
| | |
| | | controls-position="right"></el-input-number> --> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="容器长度" width="120"> |
| | | <el-table-column v-if="false" align="center" label="容器长度" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HMouldLength }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="容器宽度" width="120"> |
| | | <el-table-column v-if="false" align="center" label="容器宽度" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HMouldWidth }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="容器高度" width="120"> |
| | | <el-table-column v-if="false" align="center" label="容器高度" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HMouldHeight }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column align="center" label="折叠高度" width="120"> |
| | | <el-table-column v-if="false" align="center" label="折叠高度" width="120"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.HMouldFoldHeight }}</span> |
| | | </template> |
| | |
| | | HCusName: [ |
| | | { required: true, message: "客户不能为空", trigger: "blur" } |
| | | ], |
| | | HBeginAddrName: [ |
| | | { required: true, message: "始发地不能为空", trigger: "blur" } |
| | | ], |
| | | HEndAddrName: [ |
| | | { required: true, message: "目的地不能为空", trigger: "blur" } |
| | | HCarTypeName:[ |
| | | { required: true, message: "车型不能为空", trigger: "blur" } |
| | | ], |
| | | HDate: [ |
| | | { required: true, message: "日期不能为空", trigger: "blur" } |
| | | ], |
| | | HExRate: [ |
| | | { required: true, message: "汇率不能为空", trigger: "blur" } |
| | | ], |
| | | HCarrierName: [ |
| | | { required: true, message: "承运合同不能为空", trigger: "blur" } |
| | | ] |
| | | }, |
| | | |
| | |
| | | var width = parseFloat(result.data[i].容器宽度) || 0; |
| | | var height = parseFloat(result.data[i].容器高度) || 0; |
| | | var rowVolume = (length * width * height).toFixed(2); |
| | | |
| | | console.log(result.data) |
| | | this.editData.push( |
| | | { |
| | | "HSourceInterID": result.data[i].源单主内码, |
| | |
| | | "HQty": result.data[i].物料数量, |
| | | "HQty_origin": result.data[i].HQty, |
| | | "HVolume": rowVolume, |
| | | "HScatteredVolume": result.data[i].零单占用体积 |
| | | "HScatteredVolume": result.data[i].零单占用体积, |
| | | "HStandardQtyForMouldInPack":result.data[i].HStandardQtyForMouldInPack, |
| | | "HPackV":result.data[i].HPackV, |
| | | "HPackQTY":result.data[i].HPackQTY, |
| | | } |
| | | ) |
| | | } |
| | |
| | | try { |
| | | // 显示源单数据加载状态 |
| | | this.sourceDataLoading = true; |
| | | |
| | | var dataArray = []; |
| | | |
| | | let hmainidVal = [] |
| | | for (var i = 0; i < checkStatus.length; i++) { |
| | | hmainidVal[i] = "'" + checkStatus[i].hmainid + '-' + checkStatus[i].hsubid + "'" |
| | | } |
| | | // 使用Promise.all等待所有异步请求完成 |
| | | const promises = checkStatus.map(async (item) => { |
| | | const temp = await this.getPushSeOutStockBillInit(item.hmainid, item.hsubid); |
| | | return temp; |
| | | }); |
| | | |
| | | const results = await Promise.all(promises); |
| | | |
| | | // 过滤掉null值 |
| | | for (const result of results) { |
| | | if (result) { |
| | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 获取现有子表数据 |
| | | var existingData = this.editData || []; |
| | | var orginHQTY = 0; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // 创建物料ID映射 |
| | | var materialMap = {}; |
| | | for (var i = 0; i < dataArray.length; i++) { |
| | | console.log(dataArray) |
| | | orginHQTY = dataArray[i].数量; |
| | | var materialId = dataArray[i].HMaterID; |
| | | if (!materialMap[materialId]) { |
| | | materialMap[materialId] = []; |
| | | } |
| | | materialMap[materialId].push({ |
| | | HMaterID: dataArray[i].HMaterID, |
| | | hmainid: dataArray[i].hmainid, |
| | | hsubid: dataArray[i].hsubid, |
| | | 单据号: dataArray[i].单据号 |
| | | }); |
| | | } |
| | | // var materialMap = {}; |
| | | // for (var i = 0; i < dataArray.length; i++) { |
| | | // orginHQTY = dataArray[i].数量; |
| | | // var materialId = dataArray[i].HMaterID; |
| | | // console.log(materialId) |
| | | // if (!materialMap[materialId]) { |
| | | // materialMap[materialId] = []; |
| | | // } |
| | | // materialMap[materialId].push({ |
| | | // HMaterID: dataArray[i].HMaterID, |
| | | // hmainid: dataArray[i].hmainid, |
| | | // hsubid: dataArray[i].hsubid, |
| | | // 单据号: dataArray[i].单据号 |
| | | // }); |
| | | // } |
| | | // // 获取所有物料ID |
| | | // var ListMaterial = ""; |
| | | // for (var materialId in materialMap) { |
| | | // if (ListMaterial) ListMaterial += ";"; |
| | | // ListMaterial += materialId; |
| | | // } |
| | | // if (!ListMaterial) { |
| | | // this.$modal.msgError("没有找到物料信息,请检查选择的源单是否包含有效的物料数据!"); |
| | | // this.sourceDataLoading = false; |
| | | // return; |
| | | // } |
| | | |
| | | // 获取所有物料ID |
| | | var ListMaterial = ""; |
| | | for (var materialId in materialMap) { |
| | | if (ListMaterial) ListMaterial += ";"; |
| | | ListMaterial += materialId; |
| | | } |
| | | |
| | | if (!ListMaterial) { |
| | | this.$modal.msgError("没有找到物料信息,请检查选择的源单是否包含有效的物料数据!"); |
| | | this.sourceDataLoading = false; |
| | | return; |
| | | } |
| | | |
| | | const response = await axios.get(this.baseURL + '/WLYayBillController/GetMesByOrginBill_1', { |
| | | const response = await axios.get(this.baseURL + '/WLYayBillController/GetList', { |
| | | params: { |
| | | "ListMaterial": ListMaterial |
| | | "user": sessionStorage["HUserName"], |
| | | "hmainid_hsubid": hmainidVal.join(',') |
| | | }, |
| | | }); |
| | | console.log('源单详情', response.data.data) |
| | | let result = response.data; |
| | | if (result.count == 1) { |
| | | let res = result.data; |
| | | console.log(res) |
| | | var newRows = []; |
| | | // 为每个源单行创建对应的子表行 |
| | | for (var materialId in materialMap) { |
| | | var sourceInfos = materialMap[materialId]; |
| | | if (res.length === 0) { |
| | | // 为每个源单行创建一条记录 |
| | | for (var j = 0; j < sourceInfos.length; j++) { |
| | | var sourceInfo = sourceInfos[j]; |
| | | |
| | | // 再次检查是否已存在(双重保险) |
| | | var isExist = false; |
| | | for (var k = 0; k < existingData.length; k++) { |
| | | if (existingData[k].HSourceInterID == sourceInfo.hmainid && |
| | | existingData[k].HSourceEntryID == sourceInfo.hsubid) { |
| | | isExist = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (isExist) { |
| | | this.$modal.msgError(`源单${sourceInfo.单据号}已存在,跳过`); |
| | | continue; |
| | | } |
| | | |
| | | // 计算相关数量 |
| | | var qty = orginHQTY || 0; |
| | | var snp = 0; |
| | | var mouldQty = 0; |
| | | var HPackQTY = 0; |
| | | var rowVolume = 0; |
| | | // if |
| | | newRows.push({ |
| | | "HSourceInterID": sourceInfo.hmainid, |
| | | "HSourceEntryID": sourceInfo.hsubid, |
| | | "HSourceBillNo": sourceInfo.单据号, |
| | | "HCusID": dataArray[j].HCusID, |
| | | "HCusName": dataArray[j].客户, |
| | | "HMaterID": dataArray[j].HMaterID, |
| | | "HMaterNumber": dataArray[j].物料代码, |
| | | "HMaterName": dataArray[j].物料名称, |
| | | "HUnitID": dataArray[j].HUnitID, |
| | | // "HPackV": dataArray[j].托单位体积, |
| | | // "HStandardQtyForMouldInPack": dataArray[j].容器数量 / 托, |
| | | "HMouldID": 0, |
| | | "HMouldNumber": '', |
| | | "HMouldName": '', |
| | | "HMouldLength": 0, |
| | | "HMouldWidth": 0, |
| | | "HMouldHeight": 0, |
| | | "HMouldFoldHeight": 0, |
| | | "HQty": orginHQTY, |
| | | "HQty_origin": orginHQTY, |
| | | "HMouldQty": mouldQty, |
| | | "HVolume": rowVolume, |
| | | "HSNP": 0, |
| | | HScatteredVolume: 0, |
| | | }); |
| | | } |
| | | } else { |
| | | // 查找该物料ID对应的包装容器信息 |
| | | var materialInfo = null; |
| | | for (var i = 0; i < res.length; i++) { |
| | | if (res[i].HMaterID == materialId) { |
| | | materialInfo = res[i]; |
| | | break; |
| | | } |
| | | } |
| | | if (materialInfo) { |
| | | // 为每个源单行创建一条记录 |
| | | for (var j = 0; j < sourceInfos.length; j++) { |
| | | var sourceInfo = sourceInfos[j]; |
| | | |
| | | // 再次检查是否已存在(双重保险) |
| | | var isExist = false; |
| | | for (var k = 0; k < existingData.length; k++) { |
| | | if (existingData[k].HSourceInterID == sourceInfo.hmainid && |
| | | existingData[k].HSourceEntryID == sourceInfo.hsubid) { |
| | | isExist = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (isExist) { |
| | | this.$modal.msgError(`源单${sourceInfo.单据号}已存在,跳过`); |
| | | continue; |
| | | } |
| | | |
| | | // 计算相关数量 |
| | | var qty = orginHQTY || 0; |
| | | var snp = materialInfo.HSNP || 0; |
| | | var mouldQty = 0; |
| | | |
| | | if (snp > 0) { |
| | | mouldQty = Math.ceil(qty / snp); |
| | | } |
| | | |
| | | var HPackQTY = 0; |
| | | if (materialInfo.HStandardQtyForMouldInPack > 0 && mouldQty > 0) { |
| | | HPackQTY = Math.ceil(mouldQty / materialInfo.HStandardQtyForMouldInPack); |
| | | } |
| | | |
| | | var rowVolume = (HPackQTY * materialInfo.HPackV).toFixed(2); |
| | | newRows.push({ |
| | | "HSourceInterID": sourceInfo.hmainid, |
| | | "HSourceEntryID": sourceInfo.hsubid, |
| | | "HSourceBillNo": sourceInfo.单据号, |
| | | "HCusID": materialInfo.HCusID, |
| | | "HCusName": materialInfo.客户, |
| | | "HMaterID": materialInfo.HMaterID, |
| | | "HMaterNumber": materialInfo.物料代码, |
| | | "HMaterName": materialInfo.物料名称, |
| | | "HUnitID": materialInfo.HUnitID, |
| | | "HMouldID": materialInfo.HMouldID, |
| | | // "HPackV": materialInfo.托单位体积, |
| | | // "HStandardQtyForMouldInPack": materialInfo.容器数量 / 托, |
| | | "HMouldNumber": materialInfo.HMouldNumber, |
| | | "HMouldName": materialInfo.HMouldName, |
| | | "HMouldLength": materialInfo.长度, |
| | | "HMouldWidth": materialInfo.宽度, |
| | | "HMouldHeight": materialInfo.高度, |
| | | "HMouldFoldHeight": materialInfo.折叠高度, |
| | | "HQty": orginHQTY, |
| | | "HQty_origin": orginHQTY, |
| | | "HMouldQty": mouldQty, |
| | | "HVolume": rowVolume, |
| | | "HSNP": materialInfo.HSNP, |
| | | HScatteredVolume: 0, |
| | | "HPackV": materialInfo.HPackV, |
| | | "HStandardQtyForMouldInPack": materialInfo.HStandardQtyForMouldInPack, |
| | | "HPackQTY": HPackQTY, |
| | | }); |
| | | this.form.HTotalVolume = this.form.HTotalVolume * 1 + rowVolume * 1 |
| | | |
| | | } |
| | | // 为每个源单行创建一条记录 |
| | | for (var j = 0; j < res.length; j++) { |
| | | var sourceInfo = res[j]; |
| | | // 再次检查是否已存在(双重保险) |
| | | var isExist = false; |
| | | for (var k = 0; k < existingData.length; k++) { |
| | | if (existingData[k].HSourceInterID == sourceInfo.hmainid && |
| | | existingData[k].HSourceEntryID == sourceInfo.hsubid) { |
| | | isExist = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | if (isExist) { |
| | | this.$modal.msgError(`源单${sourceInfo.单据号}已存在,跳过`); |
| | | continue; |
| | | } |
| | | // 计算相关数量 |
| | | var qty = res[j].物料数量 || 0; |
| | | var snp = res[j].托标准容器数量 || 0; |
| | | var mouldQty = 0; |
| | | if (snp > 0) { |
| | | mouldQty = Math.ceil(qty / snp); |
| | | } |
| | | var HPackQTY = 0; |
| | | if (res[j].托数量 > 0 && mouldQty > 0) { |
| | | HPackQTY = Math.ceil(mouldQty / res[j].托数量); |
| | | } |
| | | var rowVolume = (HPackQTY * res[j].托体积).toFixed(2); |
| | | newRows.push({ |
| | | "HSourceInterID": res[j].hmainid, |
| | | "HSourceEntryID": res[j].hsubid, |
| | | "HSourceBillNo": res[j].单据号, |
| | | "HCusID": res[j].HCusID, |
| | | "HCusName": res[j].客户, |
| | | "HMaterID": res[j].HMaterID, |
| | | "HMaterNumber": res[j].物料代码, |
| | | "HMaterName": res[j].物料名称, |
| | | "HMouldNumber": res[j].容器代码, |
| | | "HMouldName": res[j].容器名称, |
| | | "HUnitID": res[j].HUnitID, |
| | | "HMouldID": res[j].HMouldID, |
| | | "HPackV": res[j].托体积, |
| | | "HStandardQtyForMouldInPack": res[j].容器数量, |
| | | "HMouldLength": res[j].长度, |
| | | "HMouldWidth": res[j].宽度, |
| | | "HMouldHeight": res[j].高度, |
| | | "HMouldFoldHeight": res[j].折叠高度, |
| | | "HModel":res[j].物料规格, |
| | | "HQty": res[j].物料数量, |
| | | "HQty_origin": orginHQTY, |
| | | "HMouldQty": mouldQty, |
| | | "HVolume": rowVolume, |
| | | "HSNP": res[j].托标准容器数量, |
| | | "HScatteredVolume": 0, |
| | | "HPackQTY": HPackQTY, |
| | | }); |
| | | this.form.HTotalVolume = this.form.HTotalVolume * 1 + rowVolume * 1 |
| | | } |
| | | |
| | | if (newRows.length === 0) { |
| | | this.$modal.msgError("没有可添加的新记录,可能是源单数据已存在或物料信息不完整!"); |
| | | this.sourceDataLoading = false; |
| | | return; |
| | | } |
| | | |
| | | // 合并现有数据和新数据 |
| | | var allData = existingData.concat(newRows); |
| | | // 渲染表格 |
| | | this.editData = allData; |
| | | |
| | | |
| | | |
| | | this.$modal.msgSuccess(`成功添加${newRows.length}条记录`); |
| | | } else { |
| | |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | this.form.HCarryStatus = 0; |
| | | var loadingRate = this.form.HLoadingRate; |
| | | if (loadingRate && typeof loadingRate === 'string') { |
| | | this.form.HLoadingRate = parseFloat(loadingRate.replace('%', '')) / 100; |