liupopo 2 years ago
parent
commit
f634554766
  1. 23
      docs/databases/table_create.sql
  2. 12
      docs/databases/table_modify.sql
  3. BIN
      docs/demofiles/采购订单(示例).xls
  4. 14
      supervise-customer-ui/src/api/supervise/purchaserequisitionpro.js
  5. 333
      supervise-customer-ui/src/views/purchaserequisition/uploadxlsx/index.vue
  6. 13
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/purchaserequisition/PurchaseRequisition.java
  7. 6
      yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/purchaserequisitionpro/PurchaseRequisitionPro.java
  8. 191
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisition/PurchaseRequisitionService.java
  9. 28
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisitionpro/PurchaseRequisitionProRest.java
  10. 26
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisitionpro/PurchaseRequisitionProService.java
  11. 4
      yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml

23
docs/databases/table_create.sql

@ -0,0 +1,23 @@
DROP TABLE IF EXISTS `purchase_requisition_checked`;
CREATE TABLE `purchase_requisition_checked` (
`id` BIGINT(32) NOT NULL AUTO_INCREMENT COMMENT 'ID,唯一编号',
`sid` VARCHAR(64) NOT NULL COMMENT 'sid',
`lockVersion` VARCHAR(2) NULL DEFAULT NULL COMMENT '记录版本,锁',
`createTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '记录创建时间',
`modifyTime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '记录最后修改时间',
`state` INT(11) NOT NULL DEFAULT '1' COMMENT '记录状态值',
`isEnable` INT(32) NOT NULL DEFAULT '1' COMMENT '记录是否可用,1:可用,0:不可用',
`isDelete` INT(32) NOT NULL DEFAULT '0' COMMENT '记录是否被删除,0:未删除,1:已经删除',
`remarks` VARCHAR(255) NULL DEFAULT NULL COMMENT '备注信息',
`createBySid` VARCHAR(64) NULL DEFAULT NULL COMMENT '创建者',
`updateBySid` VARCHAR(64) NULL DEFAULT NULL COMMENT '更新者',
`prSid` VARCHAR(100) NULL DEFAULT NULL COMMENT '订单SID',
`prCode` VARCHAR(100) NULL DEFAULT NULL COMMENT '订单编号',
`storeName` VARCHAR(100) NULL DEFAULT NULL COMMENT '仓库/门店名称',
`receiptTime` DATETIME NULL DEFAULT NULL COMMENT '收货时间',
`billNo` VARCHAR(100) NULL DEFAULT NULL COMMENT '单据号',
`billType` VARCHAR(100) NULL DEFAULT NULL COMMENT '单据类型',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='采购订单检查结果';

12
docs/databases/table_modify.sql

@ -1,8 +1,5 @@
ALTER TABLE supervise_supplychain.supplier_bank_info CHANGE createSid createBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '创建者';
ALTER TABLE supervise_supplychain.supplier_bank_info CHANGE modifySid modifyBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.supplier_bank_info CHANGE modifyBySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.supplier_bank_info CHANGE modifyBySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.supplier_bank_info CHANGE modifySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
select @@GLOBAL.sql_mode;
@ -22,14 +19,17 @@ ALTER TABLE supervise_supplychain.purchase_requisition CHANGE createSid createBy
ALTER TABLE supervise_supplychain.purchase_requisition CHANGE modifySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.purchase_requisition ADD remarks varchar(200) NULL COMMENT '备注说明';
ALTER TABLE supervise_supplychain.product_information CHANGE createSid createBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '创建者';
ALTER TABLE supervise_supplychain.product_information CHANGE modifySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.restricted_brand CHANGE createSid createBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '创建者';
ALTER TABLE supervise_supplychain.restricted_brand CHANGE modifySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.purchase_requisition_pro CHANGE createSid createBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '创建者';
ALTER TABLE supervise_supplychain.purchase_requisition_pro CHANGE modifySid updateBySid varchar(36) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '更新者';
ALTER TABLE supervise_supplychain.purchase_requisition_pro ADD remarks varchar(200) NULL COMMENT '备注说明';
ALTER TABLE supervise_supplychain.purchase_requisition_pro ADD taxInclusiveAmount DOUBLE(12,2) DEFAULT NULL COMMENT '含税金额';
ALTER TABLE supervise_supplychain.purchase_requisition_pro ADD distributionAmount DOUBLE(12,2) DEFAULT NULL COMMENT '配货金额';
ALTER TABLE supervise_supplychain.purchase_requisition_pro ADD preqCode varchar(100) DEFAULT NULL COMMENT '订单编号';

BIN
docs/demofiles/采购订单(示例).xls

Binary file not shown.

14
supervise-customer-ui/src/api/supervise/purchaserequisitionpro.js

@ -55,5 +55,19 @@ export default {
method: 'post',
data: params
})
},
// 通过mainsid查询订单内的商品列表
listByMainSid: function(sid) {
return request({
baseURL:'/api/customer',
url: '/v1/purchaserequisitionpro/listByMainSid/' + sid
})
},
// 通过mainsid检查商品状态
checkByMainSid: function(sid) {
return request({
baseURL:'/api/customer',
url: '/v1/purchaserequisitionpro/checkByMainSid/' + sid
})
}
}

333
supervise-customer-ui/src/views/purchaserequisition/uploadxlsx/index.vue

@ -6,130 +6,112 @@
<div>{{ viewTitle }}</div>
<!-- start 添加修改按钮 -->
<div style="display: flex;flex-direction: row;justify-content: flex-end;align-items: center">
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<!-- 标题按钮部分结束 -->
<!-- Start 新增修改部分 -->
<div class="listconadd" style="padding: 10px;">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>采购订单excel文件上传</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="handleDownload">下载Excel示例表样</el-button>
</div>
<el-row>
<el-col :span="8">
<div>
<el-button type="text" @click="handleDownload"><span style="border-bottom: 1px solid blue">下载Excel示例表样</span></el-button>
<div style="margin-left: 10px;margin-right: 10px">
<el-upload
ref="upload"
class="upload-demo"
accept=".xls"
:action="updateAction"
:before-upload="handleBeforeUpload"
:file-list="fileList"
:on-progress="handleProgress"
:on-success="handleSuccess"
:file-list="fileList"
:auto-upload="false"
:multiple="false"
:show-file-list="false"
:limit="1"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
<el-button type="primary" size="small">上传采购订单excel文件</el-button>
</el-upload>
</div>
</el-col>
<el-col :span="16">
<div>上传采购订单的Excel文件文件名以订单号开头类似90002303240037石家庄朋硕家居用品有限公司.xls</div>
</el-col>
</el-row>
</el-card>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
<!-- end 添加修改按钮 -->
<!-- end 详情按钮 -->
</div>
<!-- 标题按钮部分结束 -->
<!-- Start 新增修改部分 -->
<div class="listconadd" style="padding: 20px;">
<el-collapse v-model="collOrderInfoActiveNames">
<el-collapse-item title="订单详情" name="1">
<el-form ref="form_obj" :model="formobj" :rules="rules" label-position="right" class="formadd">
<el-form ref="form_obj" :model="formobj" :rules="rules" label-position="right" class="formadd" style="padding: 0px;">
<div class="title">
<div>采购订单信息</div>
</div>
<el-row>
<el-col :span="4" class="tleftb"><span>订单编号</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>订单编号</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.code }}</span>
</el-form-item>
</el-col>
<el-col :span="4" class="tleftb"><span>填单人</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>填单人</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.buyerName }}</span>
</el-form-item>
</el-col>
<el-col :span="3" class="tleftb"><span>填单时间</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.purchaseDate }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb"><span>供货单位</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>供货单位</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.supplierName }}</span>
</el-form-item>
</el-col>
<el-col :span="4" class="tleftb"><span>仓位</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>仓位</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.warehousePosition }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb"><span>采购员</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>到货日期</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.buyerName }}</span>
<span>{{ formobj.arrivalDate }}</span>
</el-form-item>
</el-col>
<el-col :span="4" class="tleftb"><span>入库单位</span></el-col>
<el-col :span="8" class="trightb">
</el-row>
<el-row>
<el-col :span="3" class="tleftb"><span>采购员</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.purchasingDeptName }}</span>
<span>{{ formobj.buyerName }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb"><span>要货单位</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>入库单位</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.purchasingDeptName }}</span>
</el-form-item>
</el-col>
<el-col :span="4" class="tleftb"><span>入库仓位</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>单据到效期</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.warehousePosition }}</span>
<span>{{ formobj.expiryDate }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb"><span>填单日期</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>要货单位</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.purchaseDate }}</span>
<span>{{ formobj.purchasingDeptName }}</span>
</el-form-item>
</el-col>
<el-col :span="4" class="tleftb"><span>到货日期</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>入库仓位</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.arrivalDate }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4" class="tleftb"><span>单据到效期</span></el-col>
<el-col :span="8" class="trightb">
<el-form-item>
<span>{{ formobj.expiryDate }}</span>
<span>{{ formobj.warehousePosition }}</span>
</el-form-item>
</el-col>
<el-col :span="4" class="tleftb"><span>完成状态</span></el-col>
<el-col :span="8" class="trightb">
<el-col :span="3" class="tleftb"><span>完成状态</span></el-col>
<el-col :span="5" class="trightb">
<el-form-item>
<span>{{ formobj.completionStatus }}</span>
</el-form-item>
@ -142,108 +124,17 @@
<span>合计金额:{{ amountInTotal }}</span>
</div>
</div>
<el-table :key="tableKey" :data="formobj.pros" :index="index" border style="width: 100%">
<el-table-column fixed label="序号" width="80px" type="index" :index="index + 1" align="center" />
<el-table-column fixed label="操作" width="100px" align="center" header-align="center">
<template slot-scope="scope">
<el-button size="mini" type="danger" @click="dataDelete(scope.$index)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="商品代码" align="center" width="200">
<template slot-scope="scope">
<span>{{ scope.row.proCode }}</span>
</template>
</el-table-column>
<el-table-column label="商品名称" align="center" width="200">
<template slot-scope="scope">
<span>{{ scope.row.proName }}</span>
</template>
</el-table-column>
<el-table-column label="规格型号" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.content }}</span>
</template>
</el-table-column>
<el-table-column label="数量" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.number }}</span>
</template>
</el-table-column>
<el-table-column label="包装数量" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.packageNumber }}</span>
</template>
</el-table-column>
<el-table-column label="包内数量" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.packageInsideNumber }}</span>
</template>
</el-table-column>
<el-table-column label="包装规格" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.packageSpec }}</span>
</template>
</el-table-column>
<el-table-column label="单位" align="center" width="200">
<template slot-scope="scope">
<span>{{ scope.row.unit }}</span>
</template>
</el-table-column>
<el-table-column label="包装价格(元)" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.packagePrice }}</span>
</template>
</el-table-column>
<el-table-column label="包合计(元)" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.packageTotalPrice }}</span>
</template>
</el-table-column>
<el-table-column label="单价(元)" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.unitPrice }}</span>
</template>
</el-table-column>
<el-table-column label="含税单价(元)" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.unitPriceTax }}</span>
</template>
</el-table-column>
<el-table-column label="合计(元)" align="center" width="120">
<template slot-scope="scope">
<span>{{ scope.row.totalPrice }}</span>
</template>
</el-table-column>
<el-table-column label="商品品类名称" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.category }}</span>
</template>
</el-table-column>
<el-table-column label="商品品类编码" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.categoryKey }}</span>
</template>
</el-table-column>
<el-table-column label="品牌名称" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.brand }}</span>
</template>
</el-table-column>
<el-table-column label="品牌编码" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.brandCode }}</span>
</template>
</el-table-column>
<el-table-column label="发货日期" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.issuanceDate }}</span>
</template>
</el-table-column>
<el-table-column label="零售金额" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.retailAmount }}</span>
</template>
</el-table-column>
<el-table :data="prolist" :index="index" border style="width: 100%">
<el-table-column fixed label="序号" width="60px" type="index" :index="index + 1" align="center" />
<el-table-column label="商品代码" align="center" width="100" prop="proCode" />
<el-table-column label="商品名称" align="center" prop="proName" />
<el-table-column label="品类编码" align="center" width="100" prop="categoryKey" />
<el-table-column label="品类名称" align="center" width="100" prop="category" />
<el-table-column label="品牌编码" align="center" width="100" prop="brandCode" />
<el-table-column label="品牌名称" align="center" width="100" prop="brand" />
<el-table-column label="合计(元)" align="center" width="150" prop="totalPrice" />
<el-table-column label="数量" align="center" width="100" prop="number" />
<el-table-column label="包装规格" align="center" width="150" prop="packageSpec" />
</el-table>
</el-form>
</el-collapse-item>
@ -274,6 +165,7 @@
<script>
import req from '@/api/supervise/purchaserequisition'
import reqPro from '@/api/supervise/purchaserequisitionpro'
export default {
name: 'PurchaserequisitionUploadxlsx',
data() {
@ -312,6 +204,7 @@
completionStatusKey: '', // key
pros: [] //
},
prolist: [],
rules: {}
}
},
@ -349,16 +242,6 @@
this.$router.go(-1)
// this.$emit('doback')
},
handleBeforeUpload(file) {
console.log('handleBeforeUpload', file)
// req.checkCodeByFileName(file.name).then(res => {
// console.log('eeee', res)
// return false
// })
},
submitUpload() {
this.$refs.upload.submit()
},
handleProgress(event, file, fileList) {
// this.progressFlag = true; //
// this.loadProgress = parseInt(event.percent); //
@ -378,38 +261,38 @@
// _this.fullscreenloading.text = ''
// }
},
handleSuccess(resp, file, fileList) {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
console.log('222', resp)
// const rdata = resp.data
// const _this = this
// _this.fullscreenloading.text = ''
// _this.uploadResultMesssage = '' + rdata.allNum + ' ' + rdata.validNum + ' ' + rdata.durations + ' '
// handleSuccess(resp, file, fileList) {
// // if (this.fullscreenloading) this.fullscreenloading.close()
// // this.fullscreenloading = null
// console.log('222', resp)
// // const rdata = resp.data
// // const _this = this
// // _this.fullscreenloading.text = ''
// // _this.uploadResultMesssage = '' + rdata.allNum + ' ' + rdata.validNum + ' ' + rdata.durations + ' '
// kchz()
// .then(res => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// console.log('333', res)
// _this.hzFilePath = res.data
// })
// .catch(e => {
// if (this.fullscreenloading) this.fullscreenloading.close()
// this.fullscreenloading = null
// })
// // kchzyc()
// // kchz()
// // .then(res => {
// // if (this.fullscreenloading) this.fullscreenloading.close()
// // this.fullscreenloading = null
// // console.log('444', res)
// // _this.ychzFilePath = res.data
// // console.log('333', res)
// // _this.hzFilePath = res.data
// // })
// // .catch(e => {
// // if (this.fullscreenloading) this.fullscreenloading.close()
// // this.fullscreenloading = null
// // })
},
// // // kchzyc()
// // // .then(res => {
// // // if (this.fullscreenloading) this.fullscreenloading.close()
// // // this.fullscreenloading = null
// // // console.log('444', res)
// // // _this.ychzFilePath = res.data
// // // })
// // // .catch(e => {
// // // if (this.fullscreenloading) this.fullscreenloading.close()
// // // this.fullscreenloading = null
// // // })
// },
showAdd() {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
@ -451,6 +334,7 @@
window.location.href = process.env.VUE_APP_BASE_API + '/v1/purchaserequisition/yb'
},
handleSuccess(resp, file, fileList) {
this.fileList = []
if (resp.success) {
this.$message({
showClose: true,
@ -458,26 +342,43 @@
message: '导入成功'
})
this.formobj = resp.data
if (this.formobj.pros.length > 0) {
this.totalQuantity = this.formobj.pros.length
this.loadProList()
this.checkPro()
} else {
this.$message({
showClose: true,
type: 'error',
message: resp.msg
})
}
},
loadProList() {
if (this.formobj.sid) {
reqPro.listByMainSid(this.formobj.sid).then(resp => {
this.prolist = resp.data
this.totalQuantity = this.prolist.length
var aa = 0
for (var i = 0; i < this.formobj.pros.length; i++) {
if (this.formobj.pros[i].totalPrice !== '') {
aa = parseFloat(aa) + parseFloat(this.formobj.pros[i].totalPrice)
for (var i = 0; i < this.prolist.length; i++) {
if (this.prolist[i].totalPrice !== '') {
aa = parseFloat(aa) + parseFloat(this.prolist[i].totalPrice)
}
}
this.amountInTotal = aa
})
}
console.log(',,1111', this.formobj.code)
if (this.formobj.code) {
this.candownload = false
},
checkPro() {
if (this.formobj.sid) {
reqPro.checkByMainSid(this.formobj.sid).then(resp => {
this.prolist = resp.data
this.totalQuantity = this.prolist.length
var aa = 0
for (var i = 0; i < this.prolist.length; i++) {
if (this.prolist[i].totalPrice !== '') {
aa = parseFloat(aa) + parseFloat(this.prolist[i].totalPrice)
}
} else {
this.$message({
showClose: true,
type: 'error',
message: resp.msg
}
this.amountInTotal = aa
})
}
},

13
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/purchaserequisition/PurchaseRequisition.java

@ -56,4 +56,17 @@ public class PurchaseRequisition extends BaseEntity {
private String completionStatus;//完成状态
@ApiModelProperty("完成状态")
private String completionStatusKey;//完成状态
@ApiModelProperty("监管0未审核,1审核通过,2审核不通过")
private String purchaseState = "0";
@ApiModelProperty("监管审批意见")
private String purchaseRemarks;
@ApiModelProperty("银行0未审核,1审核通过,2审核不通过")
private String bankState = "0"; // 银行0未审核,1审核通过,2审核不通过',
@ApiModelProperty("银行审批意见")
private String bankRemarks; // 银行审批意见',
}

6
yxt_supervise/supervise-customer/supervise-customer-api/src/main/java/com/yxt/supervise/customer/api/purchaserequisitionpro/PurchaseRequisitionPro.java

@ -58,4 +58,10 @@ public class PurchaseRequisitionPro extends BaseEntity {
private String secondCode;// 第二代码
@ApiModelProperty("零售金额")
private String retailAmount;// 零售金额
@ApiModelProperty("含税金额")
private Double taxInclusiveAmount;// 含税金额
@ApiModelProperty("配货金额")
private Double distributionAmount;// 配货金额
@ApiModelProperty("订单编号")
private String preqCode;// 订单编号
}

191
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisition/PurchaseRequisitionService.java

@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@ -133,10 +134,31 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
e.printStackTrace();
return rb.setMsg("读取Excel文件异常:" + e.getMessage());
}
boolean canInsert = checkOrderAndDelete(pr);
if (canInsert) {
baseMapper.insert(pr);
purchaseRequisitionProService.saveBatch(proList);
return rb.success().setData(pr);
}
return rb.setMsg("该订单号已经审核过,不可修改。");
}
private boolean checkOrderAndDelete(PurchaseRequisition pr) {
String code = pr.getCode();
if (StringUtils.isBlank(code)) {
return false;
}
PurchaseRequisition ppr = this.fetchByCode(code);
if (ppr == null)
return true;
if ("0".equals(ppr.getPurchaseState()) && "0".equals(ppr.getBankState())) {
purchaseRequisitionProService.deletebyMainSid(ppr.getSid());
this.deleteBySid(ppr.getSid());
return true;
}
return false;
}
private ReadListener<Map<Integer, String>> createReadListener(PurchaseRequisition pr, List<PurchaseRequisitionPro> proList) {
return new ReadListener<Map<Integer, String>>() {
@ -172,6 +194,7 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
private void addPro(Map<Integer, String> map) {
PurchaseRequisitionPro prp = new PurchaseRequisitionPro();
prp.setMainSid(pr.getSid());
prp.setPreqCode(pr.getCode());
String hsje = "";//含税金额
prp.setProCode(map.get(1));
// prp.setCategory(productInformation.getCategory());
@ -183,131 +206,53 @@ public class PurchaseRequisitionService extends MybatisBaseService<PurchaseRequi
prp.setNumber(map.get(3));
prp.setPackageSpec(map.get(4));
prp.setPackageNumber(map.get(5));
hsje = map.get(7);
Double d = 0.0;
try {
d = Double.valueOf(hsje);
} catch (Exception e) {
e.printStackTrace();
}
prp.setTaxInclusiveAmount(d);
prp.setSecondCode(map.get(10));
prp.setUnit(map.get(11));
prp.setRetailAmount(map.get(12));
String s15 = map.get(15);
Double distributionAmount = 0.0;
try {
distributionAmount = Double.valueOf(s15);
} catch (Exception e) {
e.printStackTrace();
}
prp.setDistributionAmount(distributionAmount);
prp.setPackagePrice(map.get(34)); //包装价格(元)
prp.setPackageTotalPrice(map.get(37));//包合计(元)
String value = map.get(51);
String[] split = value.split("\\[");
String v = split[0];//类别value
String key = split[1].replace("]", "");//key
prp.setCategory(v);
prp.setCategoryKey(key);
prp.setPackageNumber(map.get(53));
prp.setPackageInsideNumber(map.get(53));
BigDecimal v3 = new BigDecimal(map.get(53));//包内数量 规格
String packagePrice = prp.getPackagePrice();//包装价格
BigDecimal v4 = new BigDecimal(packagePrice);
BigDecimal divide = v4.divide(v3, 2, BigDecimal.ROUND_HALF_UP);//单价
String number = prp.getNumber();//数量
BigDecimal v5 = new BigDecimal(number);
BigDecimal v6 = divide.multiply(v5);//订货总金额
String packageInsideNumber = prp.getPackageInsideNumber();
BigDecimal vv = new BigDecimal(packagePrice).divide(new BigDecimal(packageInsideNumber), 2, BigDecimal.ROUND_HALF_UP);
prp.setUnitPrice(vv.toString());
BigDecimal bigDecimal = new BigDecimal(hsje);
BigDecimal v10 = bigDecimal.divide(new BigDecimal(map.get(53)), 2, BigDecimal.ROUND_HALF_UP);
prp.setUnitPriceTax(v10.toString());
prp.setTotalPrice(v6.toString());
// if (i == 7) {//含税单价(元)
// brandIdHSSFCell.setCellType(CellType.STRING);
// if(StringUtils.isBlank(prp.getProCode())){
// continue;
// }
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// hsje= brandIdHSSFCell.getStringCellValue();
// }
// }
prp.setRetailAmount(map.get(54));
// if (i == 10) {//第二代码
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value = brandIdHSSFCell.getStringCellValue();
// prp.setSecondCode(value);
// }
// }
// if (i == 53) {//包内数量 对应采购订单的规格
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setPackageNumber(value);
// prp.setPackageInsideNumber(value);
// BigDecimal v3 = new BigDecimal(value);//包内数量 规格
// String packagePrice = prp.getPackagePrice();//包装价格
// BigDecimal v4 = new BigDecimal(packagePrice);
// BigDecimal divide = v4.divide(v3, 2,BigDecimal.ROUND_HALF_UP);//单价
// String number = prp.getNumber();//数量
// BigDecimal v5 = new BigDecimal(number);
// BigDecimal v6 = divide .multiply( v5);//订货总金额
// String packageInsideNumber = prp.getPackageInsideNumber();
// BigDecimal v = new BigDecimal(packagePrice).divide(new BigDecimal(packageInsideNumber),2,BigDecimal.ROUND_HALF_UP);
// prp.setUnitPrice(v.toString());
// BigDecimal bigDecimal = new BigDecimal(hsje);
// BigDecimal v10 = bigDecimal.divide(new BigDecimal(value),2,BigDecimal.ROUND_HALF_UP);
// prp.setUnitPriceTax(v10.toString());
// prp.setTotalPrice(v6.toString());
// ProductInformationVo productInformationVo = productInformationService.selectByCode(prp.getProCode());
// productInformationVo.setNewestPurchasePrice(divide.toString());
// BigDecimal v122 = new BigDecimal(packagePrice).divide(new BigDecimal(prp.getPackageNumber()),2,BigDecimal.ROUND_HALF_UP);
// productInformationVo.setLatestPurchasePrice(v122.toString());
// ProductInformation pif=new ProductInformation();
// BeanUtil.copyProperties(productInformationVo,pif);
// productInformationService.updateById(pif);
// }
//
// if(StringUtils.isNotBlank(p.getCode())){
// p.setBrandSid("supervise");
// p.setBrand("监管");
// String categoryKey = prp.getCategoryKey();
// DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(categoryKey, "category");
// if(category==null){
// category=new DictCommonDetailsVo();
// category.setDictKey(categoryKey);
// category.setDictValue(prp.getCategory());
// category.setDictType("category");
// DictCommon dictCommon = new DictCommon();
// BeanUtil.copyProperties(category,dictCommon);
// dictCommonService.insert(dictCommon);
// }
// p.setCategoryKey(category.getDictKey());
// p.setCategory(category.getDictValue());
// productInformationService.insert(p);
// }
// }
// if (i == 11) {//单位
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setUnit(value);
// p.setUnit(value);
// }
// }
// if (i == 34) {//包装价格(元)
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setPackagePrice(value);
// // prp.setPackageInsideNumber(i1+"");
//
// }
// }
// if (i == 37) {//包合计(元)
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setPackageTotalPrice(value);
// //latestPurchasePrice
// }
// }
//
// if (i == 54) {//零售金额
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setRetailAmount(value);
// }
// }
// if (i == 51) {//品类
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// String[] split = value.split("\\[");
// String v = split[0];//类别value
// String key=split[1].replace("]","");//key
// prp.setCategory(v);
// prp.setCategoryKey(key);
// }
// }
// if (i == 12) {//配货价格
// brandIdHSSFCell.setCellType(CellType.STRING);
// if (StringUtils.isNotBlank(brandIdHSSFCell.getStringCellValue())) {
// String value= brandIdHSSFCell.getStringCellValue();
// prp.setRetailAmount(value);
// }
// }
//
// }else{
// System.err.println("rowNum="+rowNum+",i="+i+",value=null");
// }
// }
// if(StringUtils.isNotBlank(prp.getProCode())){
// prps.add(prp);
// }
proList.add(prp);
}

28
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisitionpro/PurchaseRequisitionProRest.java

@ -7,19 +7,13 @@ import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionExcelVo;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionQuery;
import com.yxt.supervise.customer.api.purchaserequisition.PurchaseRequisitionVo;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProExcelVo;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProFeign;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProQuery;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProVo;
import com.yxt.supervise.customer.api.purchaserequisitionpro.*;
import com.yxt.supervise.customer.biz.purchaserequisition.PurchaseRequisitionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@ -37,6 +31,7 @@ import java.util.List;
public class PurchaseRequisitionProRest implements PurchaseRequisitionProFeign {
@Autowired
PurchaseRequisitionProService purchaseRequisitionProService;
@ApiOperation("根据条件分页查询数据的列表")
@PostMapping("/listPage")
public ResultBean<PagerVo<PurchaseRequisitionProVo>> listPage(@RequestBody PagerQuery<PurchaseRequisitionProQuery> pq) {
@ -44,6 +39,7 @@ public class PurchaseRequisitionProRest implements PurchaseRequisitionProFeign {
PagerVo<PurchaseRequisitionProVo> pv = purchaseRequisitionProService.listPageVo(pq);
return rb.success().setData(pv);
}
@PostMapping("/exportExcel")
@ApiOperation(value = "采购订单商品导出")
public void exportExcel(@RequestBody PagerQuery<PurchaseRequisitionProQuery> pq, HttpServletResponse response) throws IOException {
@ -60,4 +56,20 @@ public class PurchaseRequisitionProRest implements PurchaseRequisitionProFeign {
outputStream.flush();
outputStream.close();
}
@ApiOperation("通过订单sid查询订单内的商品列表")
@GetMapping("/listByMainSid/{mainsid}")
public ResultBean<List<PurchaseRequisitionPro>> listByMainSid(@PathVariable("mainsid") String mainsid) {
ResultBean rb = ResultBean.fireFail();
List<PurchaseRequisitionPro> list = purchaseRequisitionProService.listByMainSid(mainsid);
return rb.success().setData(list);
}
@ApiOperation("通过mainsid检查商品状态")
@GetMapping("/checkByMainSid/{mainsid}")
public ResultBean<List<PurchaseRequisitionPro>> checkByMainSid(@PathVariable("mainsid") String mainsid) {
ResultBean rb = ResultBean.fireFail();
List<String> list = purchaseRequisitionProService.checkByMainSid(mainsid);
return rb.success().setData(list);
}
}

26
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/java/com/yxt/supervise/customer/biz/purchaserequisitionpro/PurchaseRequisitionProService.java

@ -5,15 +5,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionPro;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProExcelVo;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProQuery;
import com.yxt.supervise.customer.api.purchaserequisitionpro.PurchaseRequisitionProVo;
import com.yxt.supervise.customer.biz.productinformation.ProductInformationService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author wangpengfei
@ -21,6 +26,10 @@ import java.util.List;
*/
@Service
public class PurchaseRequisitionProService extends MybatisBaseService<PurchaseRequisitionProMapper, PurchaseRequisitionPro> {
@Autowired
private ProductInformationService productInformationService;
public PagerVo<PurchaseRequisitionProVo> listPageVo(PagerQuery<PurchaseRequisitionProQuery> pq) {
PurchaseRequisitionProQuery query = pq.getParams();
QueryWrapper<PurchaseRequisitionPro> qw = new QueryWrapper<>();
@ -55,6 +64,7 @@ public class PurchaseRequisitionProService extends MybatisBaseService<PurchaseRe
PagerVo<PurchaseRequisitionProVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public List<PurchaseRequisitionProExcelVo> exportExcel(PagerQuery<PurchaseRequisitionProQuery> pq) {
PurchaseRequisitionProQuery query = pq.getParams();
QueryWrapper<PurchaseRequisitionPro> qw = new QueryWrapper<>();
@ -87,4 +97,20 @@ public class PurchaseRequisitionProService extends MybatisBaseService<PurchaseRe
List<PurchaseRequisitionProExcelVo> pagging = baseMapper.exportExcel(qw);
return pagging;
}
public void deletebyMainSid(String mainSid) {
Map<String, Object> map = new HashMap<>();
map.put("mainSid", mainSid);
baseMapper.deleteByMap(map);
}
public List<PurchaseRequisitionPro> listByMainSid(String mainsid) {
QueryWrapper<PurchaseRequisitionPro> qw = new QueryWrapper<>();
qw.eq("mainSid", mainsid);
return baseMapper.selectList(qw);
}
public List<String> checkByMainSid(String mainsid) {
return null;
}
}

4
yxt_supervise/supervise-customer/supervise-customer-biz/src/main/resources/application.yml

@ -2,8 +2,8 @@ spring:
application:
name: supervise-customer
profiles:
# active: devv
active: test
active: devv
# active: test
messages:
# 国际化资源文件路径
basename: i18n/messages

Loading…
Cancel
Save