diff --git a/fuintAdmin/src/api/oilConfig/oilPurchase.js b/fuintAdmin/src/api/oilConfig/oilPurchase.js index 82cf11429..93e931de4 100644 --- a/fuintAdmin/src/api/oilConfig/oilPurchase.js +++ b/fuintAdmin/src/api/oilConfig/oilPurchase.js @@ -41,6 +41,14 @@ export function getPurchaseOrderApi(data) { params: data }) } +// 删除有关信息 +export function delPurchaseOrderApi(data) { + return request({ + url: '/business/petrolStationManagement/oilPurchaseOrder', + method: 'delete', + params: data + }) +} // 新增有关信息 export function insertPurchaseOrderApi(data) { diff --git a/fuintAdmin/src/api/oilConfig/oilStatistics.js b/fuintAdmin/src/api/oilConfig/oilStatistics.js new file mode 100644 index 000000000..d7949c4e4 --- /dev/null +++ b/fuintAdmin/src/api/oilConfig/oilStatistics.js @@ -0,0 +1,10 @@ +import request from "@/utils/request"; + +// 查询列表 +export function getTrackingApi(data) { + return request({ + url: '/business/petrolStationManagement/oilTracking/queryByPage', + method: 'get', + params: data + }) +} diff --git a/fuintAdmin/src/views/oilConfig/oilInventory/list.vue b/fuintAdmin/src/views/oilConfig/oilInventory/list.vue index 43145dfcb..5c1c8ce8f 100644 --- a/fuintAdmin/src/views/oilConfig/oilInventory/list.vue +++ b/fuintAdmin/src/views/oilConfig/oilInventory/list.vue @@ -3,7 +3,7 @@ - + @@ -41,7 +41,7 @@ type="primary" icon="el-icon-plus" @click="purchaseAdd" - >添加采购 + >添加盘点 @@ -138,8 +138,7 @@ export default { dateRange: '', // 查询参数 queryParams: { - supplierId: '', - tankName: '', + inventoryNumber:'', status: '', page:null, pageSize:null diff --git a/fuintAdmin/src/views/oilConfig/oilInventory/order.vue b/fuintAdmin/src/views/oilConfig/oilInventory/order.vue index b770712bb..0a0910eec 100644 --- a/fuintAdmin/src/views/oilConfig/oilInventory/order.vue +++ b/fuintAdmin/src/views/oilConfig/oilInventory/order.vue @@ -55,7 +55,7 @@ 保存 保存并审核 盘点并处理库存 - 作废 + 作废 @@ -91,12 +91,12 @@ - + - - + + { // 保存成功 this.$modal.msgSuccess("保存成功"); - this.getList() - + // this.getList() + this.$router.push({ path: '/oilConfig/oilInventory/list', query: { + } }); }) }) } else { @@ -636,7 +644,7 @@ export default { this_.inventoryId = response.data.id this_.state = response.data.status this_.inventoryNo.inventoryNo = response.data.inventoryNumber, - this_.inventoryNo.inventoryDate = response.data.inventoryTime, + // this_.inventoryNo.inventoryDate = response.data.inventoryTime, this_.orderList.forEach(ord=>{ let now = { @@ -659,20 +667,26 @@ export default { this.getList() + + this.$router.push({ path: '/oilConfig/oilInventory/list', query: { + } }); + }) // 新增列表之后重新刷新 - this.$router.push({ path: '/oilInventory/order', query: { - inventoryId: this_.inventoryId, - inventoryNo: this_.inventoryNo.inventoryNo, - inventoryDate: this_.inventoryNo.inventoryDate, - state: this_.status - } }); - }) + // this.$router.push({ path: '/oilInventory/order', query: { + // inventoryId: this_.inventoryId, + // inventoryNo: this_.inventoryNo.inventoryNo, + // inventoryDate: this_.inventoryNo.inventoryDate, + // state: this_.status + // } }); + // }) }) } + + }, // 判断是否可以保存 saveJudgment(){ @@ -702,6 +716,14 @@ export default { if (judgmentPermissions2 > 0){ this.storageFlag = false } + + let judgmentPermissions3 = await this.judgmentPermissions("盘点废止"); + if (judgmentPermissions3 > 0){ + this.voidFlag=false + }else { + this.voidFlag=true + + } }, // 判断权限 @@ -728,9 +750,9 @@ export default { auditInventoryApi(fil).then(res => { this.state = 'ysh' this.$modal.msgWarning("审核成功"); + this.goToAbout() }) } - }, // 入库 @@ -743,34 +765,56 @@ export default { this.$modal.msgWarning("请先选择进货时间"); return; } - // 审核 - let fil ={ - id: this.purchaseId - } - storageInventoryApi(fil).then(res => { - this.state = 'qrts' - this.$modal.msgWarning("入库成功"); - }) - + this.$confirm('确认后盘点中的对应油品入库油罐库存将发生变化,且不可逆,确认已按照盘点数量入库吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 审核 + let fil ={ + id: this.inventoryId + } + storageInventoryApi(fil).then(res => { + this.state = 'qrts' + this.$modal.msgWarning("入库成功"); + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); + }); }, // 作废 abolition(){ - if (this.purchaseId < 0) { + if (this.inventoryId < 0) { this.$modal.msgWarning("数据未保存,不可废弃"); return; } - // 审核 - let fil ={ - id: this.purchaseId - } - abolitionInventoryApi(fil).then(res => { - this.state = 'yzf' - this.$modal.msgWarning("审核成功"); + this.$confirm('确定要废弃盘点好的数据吗', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + let fil ={ + id: this.inventoryId + } + abolitionInventoryApi(fil).then(res => { + if (res.data) { + this.state = 'yzf' + this.$modal.msgWarning("作废成功"); + this.goToAbout() + } else { + this.$modal.msgWarning("暂无作废权限"); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); }) }, - - - } } diff --git a/fuintAdmin/src/views/oilConfig/oilPrice/index.vue b/fuintAdmin/src/views/oilConfig/oilPrice/index.vue index ef2bae4fe..b3df19c3e 100644 --- a/fuintAdmin/src/views/oilConfig/oilPrice/index.vue +++ b/fuintAdmin/src/views/oilConfig/oilPrice/index.vue @@ -118,7 +118,7 @@ - + @@ -165,14 +165,14 @@ - + 元 - + 元 @@ -208,7 +208,7 @@ - + @@ -254,14 +254,14 @@ - + 元 - + 元 @@ -300,7 +300,7 @@ - + @@ -318,7 +318,7 @@ - + 元 @@ -328,7 +328,7 @@ - + 元 @@ -372,18 +372,32 @@ import { dicts: ['jobState','oil_type','zhzt'], data() { + var valiNumberPass = (rule, value, callback) => {//包含小数的数字 + let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g; + if (value === '') { + callback(new Error('请输入内容')); + } else if (!reg.test(value)) { + callback(new Error('请输入数字')); + } else { + callback(); + } + }; + return { + + + oilPresetPricesRules: { numberId:[ { required: true, message: '请选择油品类型', trigger: 'change' } ], presetOilPrices: [ - {required: true, message: '请输入', trigger: 'blur'}, - { type: 'number', message: '价格必须为数字值'} + { required: true, validator:valiNumberPass, trigger: "blur" } + // {required: true, message: '请输入', trigger: 'blur'}, + // { type: 'number', message: '价格必须为数字值'} ], presetGbPrice: [ - {required: true, message: '请输入', trigger: 'blur'}, - { type: 'number', message: '价格必须为数字值'} + { required: true, validator:valiNumberPass, trigger: "blur" } ], effectiveTime:[ { required: true, message: '请选择日期', trigger: 'change' } @@ -400,12 +414,11 @@ import { { required: true, message: '请选择', trigger: 'change' } ], oilPrice: [ - {required: true, message: '请输入', trigger: 'blur'}, - { type: 'number', message: '价格必须为数字值'} + { required: true, validator:valiNumberPass, trigger: "blur" } + ], gbPrice: [ - {required: true, message: '请输入', trigger: 'blur'}, - { type: 'number', message: '价格必须为数字值'} + { required: true, validator:valiNumberPass, trigger: "blur" } ], receivingUnits: [ { required: true, message: '请选择', trigger: 'change' } @@ -493,6 +506,9 @@ import { mounted() { }, methods:{ + + + getStatusText(data) { if (data == 1) { return "停止" @@ -691,7 +707,6 @@ import { */ // 查询预设油号 getOilPresetListin() { - var this_=this getOilPresetList().then( response => { this.oilPresetPricesList = response.data.records @@ -726,7 +741,6 @@ import { insertOilPresePrices(){ // console.log(typeof oilPresetPrices.presetOilPrices); console.log("typeof oilPresetPrices.presetOilPrices",this.oilPresetPrices); - this.$refs["priForm"].validate(valid => { if (valid) { this.dialogFormPricesAdd = false @@ -734,6 +748,7 @@ import { var list = response.data this.getOilNameList(); this.getAllOilList(); + this.getOilPresetListin(); }); } }); diff --git a/fuintAdmin/src/views/oilConfig/oilPurchase/list.vue b/fuintAdmin/src/views/oilConfig/oilPurchase/list.vue index d50a22100..ba6ad8962 100644 --- a/fuintAdmin/src/views/oilConfig/oilPurchase/list.vue +++ b/fuintAdmin/src/views/oilConfig/oilPurchase/list.vue @@ -74,7 +74,7 @@ 待审核 已审核入库 已作废 - 已审核 + 已审核 @@ -192,7 +192,7 @@ export default { query: { purchaseId: data.id, purchaseNo: data.purchaseNo, - // purchaseDate: data.purchaseDate, + purchaseDate: data.purchaseDate, state: data.status } }); diff --git a/fuintAdmin/src/views/oilConfig/oilPurchase/purchaseOrder.vue b/fuintAdmin/src/views/oilConfig/oilPurchase/purchaseOrder.vue index da5dd1b8e..2815afbb1 100644 --- a/fuintAdmin/src/views/oilConfig/oilPurchase/purchaseOrder.vue +++ b/fuintAdmin/src/views/oilConfig/oilPurchase/purchaseOrder.vue @@ -46,7 +46,7 @@ 保存 保存并审核 收货并入库 - 作废 + 作废 @@ -76,27 +76,27 @@ - + - + - + - + - + - + 0) { }else { @@ -355,6 +356,11 @@ export default { this.state = 'await' } + if (this.state=='await') { + this.numberInput = false + }else { + this.numberInput = true + } this.purchaseForm.purchaseNo = this.$route.query.purchaseNo; if (this.purchaseForm.purchaseNo == null) { @@ -386,8 +392,11 @@ export default { this.getOilNameList() this.selectSuppliers() }, - orderDel() { - + orderDel(data) { + delPurchaseOrderApi(data).then(response => { + this.$modal.msgSuccess("删除成功"); + this.getList() + }) }, // 提交 submitForm: function() { @@ -553,13 +562,19 @@ export default { async JudgmentButton(){ let judgmentPermissions1 = await this.judgmentPermissions("进油审核"); if (judgmentPermissions1 > 0){ - this.auditFlag=false, - this.voidFlag=false + this.auditFlag=false } let judgmentPermissions2 = await this.judgmentPermissions("进油入库"); if (judgmentPermissions2 > 0){ this.storageFlag = false } + + let judgmentPermissions3 = await this.judgmentPermissions("进油废止"); + if (judgmentPermissions3 > 0){ + this.voidFlag=false + }else { + this.voidFlag=true + } }, // 判断权限 @@ -583,9 +598,16 @@ export default { } console.log(" id: this.purchaseId",fil) auditApi(fil).then(res => { - this.state = 'ysh' + if (res.data) { + this.state = 'ysh' + this.numberInput= true + this.$modal.msgWarning("审核成功"); + this.$router.push('/oilConfig/oilPurchase/list'); + }else { + this.$modal.msgWarning("暂无审核权限"); + + } - this.$modal.msgWarning("审核成功"); }) } @@ -599,14 +621,37 @@ export default { this.$modal.msgWarning("请先选择进货时间"); return; } - // 审核 - let fil ={ - id: this.purchaseId - } - storageApi(fil).then(res => { - this.state = 'qrts' - this.$modal.msgWarning("入库成功"); - }) + this.$confirm('确认后单据中的对应油品入库油罐库存将发生变化,且不可逆,确认已按照采购单据收货并入库吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 审核 + let fil ={ + id: this.purchaseId + } + storageApi(fil).then(res => { + if (res.data) { + this.state = 'qrts' + this.$modal.msgWarning("入库成功"); + this.numberInput= true + + this.$router.push('/oilConfig/oilPurchase/list'); + + } else { + this.$modal.msgWarning("暂无入库权限"); + } + + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); + }); + + + }, // 作废 @@ -615,14 +660,34 @@ export default { this.$modal.msgWarning("数据未保存,不可废弃"); return; } - // 审核 - let fil ={ - id: this.purchaseId - } - abolitionApi(fil).then(res => { - this.state = 'yzf' - this.$modal.msgWarning("审核成功"); + + this.$confirm('确认废弃订单吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 审核 + let fil ={ + id: this.purchaseId + } + abolitionApi(fil).then(res => { + if (res.data) { + this.state = 'yzf' + this.$modal.msgWarning("审核废弃"); + this.numberInput= true + this.$router.push('/oilConfig/oilPurchase/list'); + }else { + this.$modal.msgWarning("暂无废弃权限"); + } + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '已取消' + }); }) + + }, diff --git a/fuintAdmin/src/views/oilConfig/oilStatistics/list.vue b/fuintAdmin/src/views/oilConfig/oilStatistics/list.vue new file mode 100644 index 000000000..4c3381bae --- /dev/null +++ b/fuintAdmin/src/views/oilConfig/oilStatistics/list.vue @@ -0,0 +1,307 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 搜索 + + + + + + + + + + 油罐列表 + + + + + + + + + + + + + + + + + 启用 + 禁止 + + + + + + {{ parseTime(scope.row.updateTime) }} + + + + + 库存跟踪 + + + + + + + + + + + + + + + + + {{statisticsForm.tankName}} + + + + + 油品名称: + {{ statisticsForm.oilNumber }} + + + + + 库存数量 + {{statisticsForm.storedQuantity}}{{statisticsForm.unit}} + + + 更新时间 + {{ statisticsForm.updateTime }} + + + + + + + + + + {{ parseTime(scope.row.updateTime) }} + + + + + + + + + + + + + + + + + + diff --git a/fuintAdmin/src/views/oilConfig/oilTank/list.vue b/fuintAdmin/src/views/oilConfig/oilTank/list.vue index e055028da..5ad92d831 100644 --- a/fuintAdmin/src/views/oilConfig/oilTank/list.vue +++ b/fuintAdmin/src/views/oilConfig/oilTank/list.vue @@ -6,7 +6,7 @@ - + {{tankForm.unit}} - + {{tankForm.unit}} - - + + g/ml @@ -209,6 +209,17 @@ export default { dicts: ['zhzt'], data() { + var valiNumberPass = (rule, value, callback) => {//包含小数的数字 + let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g; + if (value === '') { + callback(new Error('请输入内容')); + } else if (!reg.test(value)) { + callback(new Error('请输入数字')); + } else { + callback(); + } + }; + return { // form :{}, // 表单名称 @@ -224,8 +235,6 @@ export default { storedQuantity: null, totalPrice: null, discountedPrice: null, - // status: '', - // inventoryStatistics: '', status: '', inventoryStatistics: '', remarks: '', @@ -266,34 +275,22 @@ export default { { required: true, message: '请选择油品类型', trigger: 'change' } ], tankVolume: [ - { required: true, message: "油罐体积不能为空", trigger: "blur" }, - { type: 'number', message: '价格必须为数字值'} - + { required: true, validator:valiNumberPass, trigger: "blur" } ], lowerWarning: [ - { required: true, message: "下线预警不能为空", trigger: "blur" }, - { type: 'number', message: '价格必须为数字值'} - + { required: true, validator:valiNumberPass, trigger: "blur" } ], oilDensity: [ - { required: true, message: "油品密度不能为空", trigger: "blur" }, - { type: 'number', message: '价格必须为数字值'} - + { required: true, validator:valiNumberPass, trigger: "blur" } ], storedQuantity: [ - { required: true, message: "存油数量不能为空", trigger: "blur" }, - { type: 'number', message: '价格必须为数字值'} - + { required: true, validator:valiNumberPass, trigger: "blur" } ], totalPrice: [ - { required: true, message: "存油总价不能为空", trigger: "blur" }, - { type: 'number', message: '价格必须为数字值'} - + { required: true, validator:valiNumberPass, trigger: "blur" } ], discountedPrice: [ - { required: true, message: "折合单价不能为空", trigger: "blur" }, - { type: 'number', message: '价格必须为数字值'} - + { required: true, validator:valiNumberPass, trigger: "blur" } ], status: [ { required: true, message: "请选择", trigger: "blur" } @@ -398,8 +395,8 @@ export default { // 表单重置 let this_ = this this_.tankForm = {} - this.tankForm.status= "启用", - this.tankForm.inventoryStatistics= "启用", + this_.tankForm.status= 'qy', + this_.tankForm.inventoryStatistics= '启用', this_.disableInput = false this_.open = true; @@ -411,10 +408,9 @@ export default { let this_ = this; this_.selectOilTypeByPrice.forEach(oilType=>{ if (oilType.numberId == this_.tankForm.numberId) { - this.tankForm.oilDensity = oilType.oilDensity - this.tankForm.oilNumber = oilType.oilType +" "+oilType.oilName - console.log("oilTypeoilType",oilType) - this.tankForm.unit = oilType.unit + this_.tankForm.oilDensity = oilType.oilDensity + this_.tankForm.oilNumber = oilType.oilType +" "+oilType.oilName + this_.tankForm.unit = oilType.unit } }) }, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilPurchaseController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilPurchaseController.java index 91df053f0..d375d49cc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilPurchaseController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilPurchaseController.java @@ -101,19 +101,7 @@ public class OilPurchaseController extends BaseController { */ @PostMapping public ResponseObject add(@RequestBody OilPurchase oilPurchase) { - AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); - oilPurchase.setCreateBy(nowAccountInfo.getStaffId().toString()); - oilPurchase.setCreator(nowAccountInfo.getStaffId().toString()); - oilPurchase.setStatus("await"); - // 获取当前时间 -// Date currentDate = new Date(); - oilPurchase.setCreatedAt(new Date()); -// // 创建一个SimpleDateFormat对象,指定想要的日期时间格式 -// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// -// // 使用SimpleDateFormat格式化日期时间 -// String formattedDate = dateFormat.format(currentDate); return getSuccessResult(this.oilPurchaseService.insert(oilPurchase)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTankController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTankController.java index b11040528..cc8d26576 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTankController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTankController.java @@ -36,7 +36,7 @@ public class OilTankController extends BaseController { */ @GetMapping("queryByPage") public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize",defaultValue = "1000") Integer pageSize, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, @Param("oilTank") OilTank oilTank) { Page page =new Page(pageNo,pageSize); IPage oilTanks = this.oilTankService.queryByPage(page, oilTank); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTrackingController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTrackingController.java new file mode 100644 index 000000000..e87ea0c94 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/controller/OilTrackingController.java @@ -0,0 +1,94 @@ +package com.fuint.business.petrolStationManagement.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.petrolStationManagement.entity.OilTank; +import com.fuint.business.petrolStationManagement.entity.OilTracking; +import com.fuint.business.petrolStationManagement.service.OilTrackingService; +import com.fuint.framework.web.BaseController; +import com.fuint.framework.web.ResponseObject; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.PageRequest; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * (OilTracking)表控制层 + * + * @author makejava + * @since 2023-10-25 11:55:13 + */ +@RestController +@RequestMapping("business/petrolStationManagement/oilTracking") +public class OilTrackingController extends BaseController { + /** + * 服务对象 + */ + @Resource + private OilTrackingService oilTrackingService; + + /** + * 分页查询 + * + * @param oilTracking 筛选条件 + * @param pageNo 分页对象 + * @return 查询结果 + */ + @GetMapping("queryByPage") + public ResponseObject queryByPage(@RequestParam(value = "page",defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize, + @Param("oilTracking") OilTracking oilTracking) { + Page page =new Page(pageNo,pageSize); + IPage oilTrackingIPage = this.oilTrackingService.queryByPage(page, oilTracking); + return getSuccessResult(oilTrackingIPage); + } + + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("{id}") + public ResponseObject queryById(@PathVariable("id") Integer id) { + return getSuccessResult(this.oilTrackingService.queryById(id)); + } + + /** + * 新增数据 + * + * @param oilTracking 实体 + * @return 新增结果 + */ + @PostMapping + public ResponseObject add(@RequestBody OilTracking oilTracking) { + return getSuccessResult(this.oilTrackingService.insert(oilTracking)); + } + + /** + * 编辑数据 + * + * @param oilTracking 实体 + * @return 编辑结果 + */ + @PutMapping + public ResponseObject edit(@RequestBody OilTracking oilTracking) { + return getSuccessResult(this.oilTrackingService.update(oilTracking)); + } + + /** + * 删除数据 + * + * @param id 主键 + * @return 删除是否成功 + */ + @DeleteMapping + public ResponseObject deleteById(Integer id) { + return getSuccessResult(this.oilTrackingService.deleteById(id)); + } + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilPurchase.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilPurchase.java index 9c9e521f0..541bc7195 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilPurchase.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilPurchase.java @@ -59,7 +59,7 @@ public class OilPurchase extends BaseEntity { /** * 制单时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") +// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private Date createdAt; /** * 状态 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilTracking.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilTracking.java new file mode 100644 index 000000000..b587f3fb8 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/entity/OilTracking.java @@ -0,0 +1,46 @@ +package com.fuint.business.petrolStationManagement.entity; + +import com.fuint.repository.model.base.BaseEntity; +import lombok.Data; + +import java.util.Date; +import java.io.Serializable; + +/** + * (OilTracking)实体类 + * + * @author makejava + * @since 2023-10-25 11:55:13 + */ +@Data +public class OilTracking extends BaseEntity { + private static final long serialVersionUID = 370742420512851869L; + /** + * 库存跟踪id + */ + private Integer id; + /** + * 单据 + */ + private String document; + /** + * 单号 + */ + private String orderNumber; + /** + * 变动数量 + */ + private double quantityChange; + /** + * 店铺ID + */ + private Integer storeId; + /** + * 关联油罐id + */ + private Integer tankId; + + + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilInventoryOrderMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilInventoryOrderMapper.java index c82c74c54..36f73b0b6 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilInventoryOrderMapper.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilInventoryOrderMapper.java @@ -40,6 +40,9 @@ public interface OilInventoryOrderMapper { List getAllList(OilInventoryOrder oilInventoryOrder); + + List getAllList2(@Param("oilInventoryOrder") OilInventoryOrder oilInventoryOrder); + /** * 统计总行数 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilTrackingMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilTrackingMapper.java new file mode 100644 index 000000000..a0a8e499f --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/OilTrackingMapper.java @@ -0,0 +1,85 @@ +package com.fuint.business.petrolStationManagement.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.petrolStationManagement.entity.OilTracking; +import org.apache.ibatis.annotations.Param; +import java.util.List; + +/** + * (OilTracking)表数据库访问层 + * + * @author makejava + * @since 2023-10-25 11:55:13 + */ +public interface OilTrackingMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + OilTracking queryById(Integer id); + + /** + * 查询指定行数据 + * + * @param oilTracking 查询条件 + * @param page + * 分页对象 + * @return 对象列表 + */ + IPage queryAllByLimit(@Param("page") Page page, @Param("oilTracking") OilTracking oilTracking); + + /** + * 统计总行数 + * + * @param oilTracking 查询条件 + * @return 总行数 + */ + long count(OilTracking oilTracking); + + /** + * 新增数据 + * + * @param oilTracking 实例对象 + * @return 影响行数 + */ + int insert(OilTracking oilTracking); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 批量新增或按主键更新数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 + */ + int insertOrUpdateBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param oilTracking 实例对象 + * @return 影响行数 + */ + int update(OilTracking oilTracking); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml index f46111410..4ee4890da 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilGunMapper.xml @@ -142,8 +142,8 @@ - insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by, number_id) - values (#{gunName}, #{tankId}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy}, #{numberId}) + insert into oil_gun(gun_name, tank_id, status, store_id, create_time, update_time, create_by, update_by, number_id, oil_machine_gun_number) + values (#{gunName}, #{tankId}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy}, #{numberId}, #{oilMachineGunNumber}) @@ -202,6 +202,9 @@ number_id = #{numberId}, + + oil_machine_gun_number = #{oilMachineGunNumber}, + where id = #{id} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryMapper.xml index d034e2f49..d3fb85171 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryMapper.xml @@ -154,6 +154,15 @@ LEFT JOIN oil_tank ot ON ot.id = opo.tank_id LEFT JOIN mt_staff ms1 ON op.creator = ms1.id LEFT JOIN mt_staff ms2 ON op.reviewer = ms2.id + + + and op.status = #{oilInventory.status} + + + and op.inventory_number LIKE CONCAT('%', #{oilInventory.inventoryNumber}, '%') + + + GROUP BY op.id diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryOrderMapper.xml index d16c63c1f..60664f80c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilInventoryOrderMapper.xml @@ -135,6 +135,7 @@ CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName, current_average_price currentAveragePrice, ot.stored_quantity currentInventoryVolume, + ot.inventory_time inventoryTime, oi.inventory_volume inventoryVolume, oi.stock_difference stockDifference, oi.profit_loss_amount profitLossAmount @@ -161,6 +162,29 @@ where opo.store_id = #{storeId} + + + SELECT + oi.id id, + ot.tank_name tankName, + ot.id tankId, + op.inventory_number inventoryNumber, + CONCAT( onn.oil_type, ' ', onn.oil_name ) numberName, + current_average_price currentAveragePrice, + ot.stored_quantity currentInventoryVolume, + oi.inventory_volume inventoryVolume, + oi.stock_difference stockDifference, + oi.profit_loss_amount profitLossAmount + FROM + oil_inventory_order oi + LEFT JOIN oil_inventory op ON oi.inventory_id = op.id + LEFT JOIN oil_tank ot ON ot.id = oi.tank_id + LEFT JOIN oil_number n ON oi.number_id = n.number_id + LEFT JOIN oil_name onn ON n.oil_name = onn.id + where + oi.inventory_id = #{oilInventoryOrder.inventoryId} + + insert into oil_inventory_order(inventory_id, number_id, tank_id, current_average_price, current_inventory_volume, inventory_volume, stock_difference, profit_loss_amount, store_id, create_time, update_time, create_by, update_by) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseMapper.xml index c8c2ea69a..f9c60163c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseMapper.xml @@ -161,6 +161,7 @@ op.reviewer reviewer, op.created_at createdAt, op.the_document_amount theDocumentAmount, + op.purchase_date purchaseDate, ms1.real_name creatorName, ms2.real_name reviewerName from @@ -190,7 +191,7 @@ insert into oil_purchase(purchase_no, purchase_date, oil_type, supplier, density, purchase_quantity, unit_price, creator, reviewer, created_at, status, store_id, create_time, update_time, create_by, update_by,the_document_amount) - values (#{purchaseNo}, #{purchaseDate}, #{oilType}, #{supplier}, #{density}, #{purchaseQuantity}, #{unitPrice}, #{creator}, #{reviewer}, #{createdAt}, #{status}, #{storeId}, #{createTime}, #{updateTime}, #{createBy}, #{updateBy},#{theDocumentAmount}) + values (#{purchaseNo}, #{purchaseDate}, #{oilType}, #{supplier}, #{density}, #{purchaseQuantity}, #{unitPrice}, #{creator}, #{reviewer}, #{createTime}, #{status}, #{storeId}, #{createTime}, #{createTime}, #{createBy}, #{updateBy},#{theDocumentAmount}) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseOrderMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseOrderMapper.xml index 43fa92735..578be2dbf 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseOrderMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilPurchaseOrderMapper.xml @@ -135,6 +135,7 @@ opo.purchase_volume purchaseVolume, opo.discounted_price discountedPrice, opo.tank_id tankId , + op.purchase_no purchaseNo , onn.oil_type oilType, onn.oil_name oilName, os.supplier_name supplierName, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTankMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTankMapper.xml index 033743f7c..ec237e75f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTankMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTankMapper.xml @@ -325,6 +325,7 @@ update oil_tank set stored_quantity = stored_quantity + #{storedQuantity} , total_price = total_price + #{totalPrice}, + update_time = NOW(), discounted_price = #{discountedPrice} where id = #{id} @@ -333,6 +334,7 @@ update oil_tank set stored_quantity = #{storedQuantity} , total_price = #{totalPrice}, + update_time = NOW(), discounted_price = #{discountedPrice} where id = #{id} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTrackingMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTrackingMapper.xml new file mode 100644 index 000000000..411cbf1df --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/mapper/xml/OilTrackingMapper.xml @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + select + id, document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id + from oil_tracking + where id = #{id} + + + + + select + id, document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id + from oil_tracking + + + and id = #{oilTracking.id} + + + and document = #{oilTracking.document} + + + and order_number = #{oilTracking.orderNumber} + + + + and store_id = #{oilTracking.storeId} + + + and create_time = #{oilTracking.createTime} + + + and update_time = #{oilTracking.updateTime} + + + and create_by = #{oilTracking.createBy} + + + and update_by = #{oilTracking.updateBy} + + + and tank_id = #{oilTracking.tankId} + + + + + + + + + select count(1) + from oil_tracking + + + and id = #{id} + + + and document = #{document} + + + and order_number = #{orderNumber} + + + and quantity_change = #{quantityChange} + + + and store_id = #{storeId} + + + and create_time = #{createTime} + + + and update_time = #{updateTime} + + + and create_by = #{createBy} + + + and update_by = #{updateBy} + + + and tank_id = #{tankId} + + + + + + + insert into oil_tracking(document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id) + values (#{document}, #{orderNumber}, #{quantityChange}, #{storeId}, #{createTime},NOW(), #{createBy}, #{updateBy}, #{tankId}) + + + + insert into oil_tracking(document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id) + values + + (#{entity.document}, #{entity.orderNumber}, #{entity.quantityChange}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}, #{entity.tankId}) + + + + + insert into oil_tracking(document, order_number, quantity_change, store_id, create_time, update_time, create_by, update_by, tank_id) + values + + (#{entity.document}, #{entity.orderNumber}, #{entity.quantityChange}, #{entity.storeId}, #{entity.createTime}, #{entity.updateTime}, #{entity.createBy}, #{entity.updateBy}, #{entity.tankId}) + + on duplicate key update + document = values(document), + order_number = values(order_number), + quantity_change = values(quantity_change), + store_id = values(store_id), + create_time = values(create_time), + update_time = values(update_time), + create_by = values(create_by), + update_by = values(update_by), + tank_id = values(tank_id) + + + + + update oil_tracking + + + document = #{document}, + + + order_number = #{orderNumber}, + + + quantity_change = #{quantityChange}, + + + store_id = #{storeId}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + create_by = #{createBy}, + + + update_by = #{updateBy}, + + + tank_id = #{tankId}, + + + where id = #{id} + + + + + delete from oil_tracking where id = #{id} + + + + diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilTrackingService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilTrackingService.java new file mode 100644 index 000000000..36a0e191e --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/OilTrackingService.java @@ -0,0 +1,58 @@ +package com.fuint.business.petrolStationManagement.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.petrolStationManagement.entity.OilTank; +import com.fuint.business.petrolStationManagement.entity.OilTracking; +import org.apache.ibatis.annotations.Param; + +/** + * (OilTracking)表服务接口 + * + * @author makejava + * @since 2023-10-25 11:55:13 + */ +public interface OilTrackingService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + OilTracking queryById(Integer id); + + /** + * 分页查询 + * + * @param oilTracking 筛选条件 + * @param pageRequest 分页对象 + * @return 查询结果 + */ + IPage queryByPage(@Param("page") Page page, @Param("oilTracking") OilTracking oilTracking); + + /** + * 新增数据 + * + * @param oilTracking 实例对象 + * @return 实例对象 + */ + OilTracking insert(OilTracking oilTracking); + + /** + * 修改数据 + * + * @param oilTracking 实例对象 + * @return 实例对象 + */ + OilTracking update(OilTracking oilTracking); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java index 3d10c4145..a42a745ae 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilGunServiceImpl.java @@ -95,13 +95,15 @@ public class OilGunServiceImpl implements OilGunService { return false; } oilGun.setCreateBy(accountInfo.getId().toString()); + + System.out.println("oilGun"+oilGun.getOilMachineGunNumber()); return this.oilGunDao.insert(oilGun)>0; } // 判断是否有同一名称的数据 public boolean checkData(OilGun oilGun) { List oilGunList = oilGunDao.checkData(oilGun); - return oilGunList.size() > 0; + return oilGunList.size() > 1; } /** diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilInventoryOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilInventoryOrderServiceImpl.java index ccb8e272b..45e1c3daf 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilInventoryOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilInventoryOrderServiceImpl.java @@ -11,7 +11,9 @@ import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; @@ -36,6 +38,13 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService { @Resource private ILJStaffService iljStaffService; + + @Resource + OilTankMapper oilTankMapper; + + @Resource + OilTrackingMapper oilTrackingMapper; + /** * 通过ID查询单条数据 * @@ -212,18 +221,18 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService { return false; } - @Resource - OilTankMapper oilTankMapper; @Override + @Transactional(rollbackFor = Exception.class) public boolean storage(Integer id) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); String oilIntake = "盘点入库"; int audit = iljStaffService.auditPrem(oilIntake); if (audit>0) { // 1.查询所有的数据 OilInventoryOrder oilInventoryOrder = new OilInventoryOrder(); oilInventoryOrder.setInventoryId(id); - List allList = oilInventoryOrderDao.getAllList(oilInventoryOrder); + List allList = oilInventoryOrderDao.getAllList2(oilInventoryOrder); for (OilInventoryOrderVO oilInventoryOrderVO : allList) { OilTank oilTank = new OilTank(); oilTank.setId(oilInventoryOrderVO.getTankId()); @@ -235,6 +244,17 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService { oilTank.setTotalPrice(bigDecimal.doubleValue()); oilTank.setDiscountedPrice(oilInventoryOrderVO.getCurrentAveragePrice()); oilTankMapper.accumulate2(oilTank); + + + // 插入到库存跟踪 + OilTracking oilTracking = new OilTracking(); + oilTracking.setStoreId(nowAccountInfo.getStoreId()); + oilTracking.setCreateBy(nowAccountInfo.getStaffId().toString()); + oilTracking.setDocument(oilIntake); + oilTracking.setQuantityChange(oilInventoryOrderVO.getInventoryVolume()); + oilTracking.setTankId(oilInventoryOrderVO.getTankId()); + oilTracking.setOrderNumber(oilInventoryOrderVO.getInventoryNumber()); + oilTrackingMapper.insert(oilTracking); } // 2.将数据填充到油罐里面 @@ -249,7 +269,7 @@ public class OilInventoryOrderServiceImpl implements OilInventoryOrderService { } // 修改审核人 - private boolean edit(Integer id){ + public boolean edit(Integer id){ AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); OilInventory oilPurchase = new OilInventory(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java index cd1cf50ff..9320b7b12 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilNumberServiceImpl.java @@ -49,7 +49,7 @@ public class OilNumberServiceImpl extends ServiceImpl 0) { + if ( i> 1) { return 0; } return baseMapper.insertOilNumber(oilNumber); @@ -61,7 +61,7 @@ public class OilNumberServiceImpl extends ServiceImpl 0) { + if ( i> 1) { return -1; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseOrderServiceImpl.java index 8a39ea7e6..3eecaa91b 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseOrderServiceImpl.java @@ -7,9 +7,11 @@ import com.fuint.business.member.service.impl.LJStaffServiceImpl; import com.fuint.business.petrolStationManagement.entity.OilPurchase; import com.fuint.business.petrolStationManagement.entity.OilPurchaseOrder; import com.fuint.business.petrolStationManagement.entity.OilTank; +import com.fuint.business.petrolStationManagement.entity.OilTracking; import com.fuint.business.petrolStationManagement.mapper.OilPurchaseMapper; import com.fuint.business.petrolStationManagement.mapper.OilPurchaseOrderMapper; import com.fuint.business.petrolStationManagement.mapper.OilTankMapper; +import com.fuint.business.petrolStationManagement.mapper.OilTrackingMapper; import com.fuint.business.petrolStationManagement.service.OilPurchaseOrderService; import com.fuint.business.petrolStationManagement.vo.OilPurchaseOrderVO; import com.fuint.business.petrolStationManagement.vo.OilTankVO; @@ -18,6 +20,7 @@ import com.fuint.common.util.TokenUtil; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; @@ -31,6 +34,7 @@ import java.util.List; */ @Service("oilPurchaseOrderService") public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService { + @Resource private OilPurchaseOrderMapper oilPurchaseOrderDao; @@ -40,6 +44,13 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService { @Resource private ILJStaffService iljStaffService; + @Resource + OilTankMapper oilTankMapper; + + @Resource + OilTrackingMapper oilTrackingMapper; + + /** * 通过ID查询单条数据 * @@ -159,11 +170,13 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService { return false; } - @Resource - OilTankMapper oilTankMapper; @Override + @Transactional(rollbackFor = Exception.class) public boolean storage(Integer id) { + AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); + + String oilIntake = "进油入库"; int audit = iljStaffService.auditPrem(oilIntake); if (audit>0) { @@ -178,6 +191,15 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService { oilTank.setTotalPrice(oilPurchaseOrderVO.getTotalAmount()); oilTank.setDiscountedPrice(oilPurchaseOrderVO.getPurchasePrice()); oilTankMapper.accumulate(oilTank); + // 插入到库存跟踪 + OilTracking oilTracking = new OilTracking(); + oilTracking.setStoreId(nowAccountInfo.getStoreId()); + oilTracking.setCreateBy(nowAccountInfo.getStaffId().toString()); + oilTracking.setDocument(oilIntake); + oilTracking.setQuantityChange(oilPurchaseOrderVO.getPurchaseVolume()); + oilTracking.setTankId(oilPurchaseOrderVO.getTankId()); + oilTracking.setOrderNumber(oilPurchaseOrderVO.getPurchaseNo()); + oilTrackingMapper.insert(oilTracking); } // 2.将数据填充到油罐里面 @@ -192,7 +214,7 @@ public class OilPurchaseOrderServiceImpl implements OilPurchaseOrderService { } // 修改审核人 - private boolean edit(Integer id){ + public boolean edit(Integer id){ AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); OilPurchase oilPurchase = new OilPurchase(); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseServiceImpl.java index 0710d8442..73978ee84 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilPurchaseServiceImpl.java @@ -111,6 +111,20 @@ public class OilPurchaseServiceImpl implements OilPurchaseService { AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); oilPurchase.setStoreId(nowAccountInfo.getStoreId()); oilPurchase.setCreateBy(nowAccountInfo.getStaffId().toString()); + + oilPurchase.setCreator(nowAccountInfo.getStaffId().toString()); + + oilPurchase.setStatus("await"); + // 获取当前时间 +// Date currentDate = new Date(); +// oilPurchase.setCreatedAt(new Date()); +// // 创建一个SimpleDateFormat对象,指定想要的日期时间格式 +// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); +// +// // 使用SimpleDateFormat格式化日期时间 +// String formattedDate = dateFormat.format(currentDate); + + this.oilPurchaseDao.insert(oilPurchase); return oilPurchase; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTankServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTankServiceImpl.java index 281bc8804..842f0ea48 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTankServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTankServiceImpl.java @@ -44,8 +44,8 @@ public class OilTankServiceImpl implements OilTankService { */ @Override public IPage queryByPage(@Param("page") Page page,@Param("oilTank") OilTank oilTank) { -// long total = this.oilTankDao.count(oilTank); -// return new PageImpl<>(this.oilTankDao.queryAllByLimit(oilTank, pageRequest), pageRequest, total); + AccountInfo accountInfo = TokenUtil.getNowAccountInfo(); + oilTank.setStoreId(accountInfo.getStoreId()); return oilTankDao.queryAllByLimit(page, oilTank); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTrackingServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTrackingServiceImpl.java new file mode 100644 index 000000000..d54fcac86 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/service/impl/OilTrackingServiceImpl.java @@ -0,0 +1,88 @@ +package com.fuint.business.petrolStationManagement.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.fuint.business.petrolStationManagement.entity.OilTank; +import com.fuint.business.petrolStationManagement.entity.OilTracking; +import com.fuint.business.petrolStationManagement.mapper.OilTrackingMapper; +import com.fuint.business.petrolStationManagement.service.OilTrackingService; +import com.fuint.common.dto.AccountInfo; +import com.fuint.common.util.TokenUtil; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Service; + +import org.springframework.data.domain.PageRequest; + +import javax.annotation.Resource; + +/** + * (OilTracking)表服务实现类 + * + * @author makejava + * @since 2023-10-25 11:55:13 + */ +@Service("oilTrackingService") +public class OilTrackingServiceImpl implements OilTrackingService { + @Resource + private OilTrackingMapper oilTrackingDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public OilTracking queryById(Integer id) { + return this.oilTrackingDao.queryById(id); + } + + /** + * 分页查询 + * + * @param oilTracking 筛选条件 + * @param page 分页对象 + * @return 查询结果 + */ + @Override + public IPage queryByPage(@Param("page") Page page, @Param("oilTracking") OilTracking oilTracking) { + AccountInfo accountInfo = TokenUtil.getNowAccountInfo(); + oilTracking.setStoreId(accountInfo.getStoreId()); + return oilTrackingDao.queryAllByLimit(page, oilTracking); + } + + /** + * 新增数据 + * + * @param oilTracking 实例对象 + * @return 实例对象 + */ + @Override + public OilTracking insert(OilTracking oilTracking) { + this.oilTrackingDao.insert(oilTracking); + return oilTracking; + } + + /** + * 修改数据 + * + * @param oilTracking 实例对象 + * @return 实例对象 + */ + @Override + public OilTracking update(OilTracking oilTracking) { + this.oilTrackingDao.update(oilTracking); + return this.queryById(oilTracking.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.oilTrackingDao.deleteById(id) > 0; + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilInventoryOrderVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilInventoryOrderVO.java index 58418a357..1fb4203ca 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilInventoryOrderVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilInventoryOrderVO.java @@ -3,9 +3,19 @@ package com.fuint.business.petrolStationManagement.vo; import com.fuint.business.petrolStationManagement.entity.OilInventoryOrder; import lombok.Data; +import java.util.Date; + @Data public class OilInventoryOrderVO extends OilInventoryOrder { private String tankName; private Integer tankId; private String numberName; + /** + * 盘点单号 + */ + private String inventoryNumber; + /** + * 盘点时间 + */ + private Date inventoryTime; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPurchaseOrderVO.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPurchaseOrderVO.java index 376baa94a..6b0cb2f4c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPurchaseOrderVO.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/petrolStationManagement/vo/OilPurchaseOrderVO.java @@ -12,4 +12,8 @@ public class OilPurchaseOrderVO extends OilPurchaseOrder { private String supplierName; // 供应商名称 private String storedQuantity; // 库存数量 private String numberName; // + /** + * 进货单号 + */ + private String purchaseNo; } diff --git a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/base/BaseEntity.java b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/base/BaseEntity.java index 9db41cc3d..2057cebff 100644 --- a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/base/BaseEntity.java +++ b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/base/BaseEntity.java @@ -28,14 +28,14 @@ public class BaseEntity implements Serializable private String createBy; /** 创建时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date createTime; /** 更新者 */ private String updateBy; /** 更新时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") private Date updateTime; /** 备注 */