Browse Source

完成入库查询添加单价金额字段

lwx_dev
erdanergou 2 years ago
parent
commit
c27e092ba8
  1. 7
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 3
      src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml
  3. 5
      src/main/java/com/dreamchaser/depository_manage/entity/ApplicationInRecord.java
  4. 8
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationInRecordP.java
  5. 43
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  6. 35
      src/main/resources/templates/pages/depository/table-in.html

7
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -908,13 +908,6 @@ public class DepositoryRecordController {
list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map, userKey, token);
recordPCount = depositoryRecordService.findApplicationInRecordPCountByUser(userToken, map);
}
for (ApplicationInRecordP applicationInRecordP : list) {
if (applicationInRecordP.getPrice() != null) {
applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100);
} else {
applicationInRecordP.setPrice(0.0);
}
}
return new RestResponse(list, recordPCount, 200);
}

3
src/main/java/com/dreamchaser/depository_manage/depository_mapper/DepositoryRecordMapper.xml

@ -85,6 +85,7 @@
<result column="airapproverMessage" property="airapproverMessage" jdbcType="VARCHAR"/>
<result column="mbrand" property="mbrand" jdbcType="VARCHAR"/>
<result column="pkingdeecode" property="pkingdeecode" jdbcType="VARCHAR"/>
<result column="mprice" property="mprice" jdbcType="INTEGER"/>
</resultMap>
@ -183,7 +184,7 @@
</sql>
<sql id="ApplicationInRecordInfo">
airid,did,airmproducedDate,mname,quantity,price,tname,applicant_time,aircode,dname,applicant_id,applyRemark,mcode,mversion,munit,mtexture,mkingdeecode,mdepositoryCode,airUnit,flagForGroup,mid,airPlaceId,airapproverPass,airapproverTime,airapproverId,airstate,airapproverMessage,airtoGroupId,mbrand,pkingdeecode
airid,did,airmproducedDate,mname,mprice,quantity,price,tname,applicant_time,aircode,dname,applicant_id,applyRemark,mcode,mversion,munit,mtexture,mkingdeecode,mdepositoryCode,airUnit,flagForGroup,mid,airPlaceId,airapproverPass,airapproverTime,airapproverId,airstate,airapproverMessage,airtoGroupId,mbrand,pkingdeecode
</sql>
<sql id="ApplicationOutRecordInfo">

5
src/main/java/com/dreamchaser/depository_manage/entity/ApplicationInRecord.java

@ -21,6 +21,11 @@ public class ApplicationInRecord {
* 入库金额
*/
private Double price;
/**
* 物料单价
*/
private Integer mprice;
/**
* 入库物品类型
*/

8
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationInRecordP.java

@ -1,6 +1,7 @@
package com.dreamchaser.depository_manage.pojo;
import com.dreamchaser.depository_manage.entity.ApplicationInRecord;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data;
@Data
@ -159,6 +160,10 @@ public class ApplicationInRecordP {
* 物料品牌
*/
private String mbrand;
/**
* 物料单价
*/
private Double mprice;
/**
@ -169,7 +174,7 @@ public class ApplicationInRecordP {
public ApplicationInRecordP(ApplicationInRecord ar) {
this.id = ar.getId();
this.mname = ar.getMname();
this.quantity = (double) ar.getQuantity() / 100;
this.quantity = ObjectFormatUtil.divide(ar.getQuantity(), 100.0,2);
this.price = ar.getPrice();
this.materialTypeName = ar.getMaterialTypeName();
this.applicantName = ar.getApplicantName();
@ -189,6 +194,7 @@ public class ApplicationInRecordP {
this.airUnit = ar.getAirUnit();
this.flagForGroup = ar.getFlagForGroup();
this.mid = ar.getMid();
this.mprice = ObjectFormatUtil.divide(ar.getMprice(),100.0,2);
this.placeId = ar.getPlaceId();
this.airtoGroupId = ar.getAirtoGroupId();
this.airapproverPass = ar.getAirapproverPass();

43
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -776,8 +776,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
flagForApproval = isApprovalPass;
}
map.put("flagForApproval", flagForApproval);
}
else {
} else {
// 设置审批权限
map.put("inType", "mt");
// 获取当前类别物料是否需要审批
@ -3196,8 +3195,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
int flagForOpenDepository = record.getFlagForOpenDepository();
if (manager1 != null && !"".equals(manager1)) {
flagForHasOtherDepository = false;
}
else {
} else {
if (flagForOpenDepository != 1) {
// 如果是开放仓库
@ -3417,8 +3415,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
s = "PangFuZhen,";
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toLong(id), s, userAgent, 1, userKey, token);
});
}
else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) {
} else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) {
// 如果是平衡岗人员审批且进入该流程
String result = "";
@ -3538,8 +3535,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
s = "PangFuZhen,";
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toLong(id), s, userAgent, 1, userKey, token);
});
}
else {
} else {
String result = "";
// 开启线程更改其他用户卡片模板样式
String simpleTime = DateUtil.getSimpleTime(new Date());
@ -4793,6 +4789,31 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
userByPortById.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(applicantId, userByPortById);
}
// 当前物料单价
double mprice = ObjectFormatUtil.divide(applicationInRecord.getMprice(), 100.0, 2);
// 获取入库数据
double quantity = ObjectFormatUtil.divide(applicationInRecord.getQuantity(), 100.0, 2);
// 获取入库单位
String airUnit = applicationInRecord.getAirUnit();
// 获取入库物料单位
String munit = applicationInRecord.getMunit();
double amounts = 0.0;
if (munit.equals(airUnit)) {
// 如果是基础单位
amounts = ObjectFormatUtil.multiply(mprice, quantity);
} else {
// 获取当前对应的拆单记录
Map<String, Object> paramForSplitInfo = new HashMap<>();
paramForSplitInfo.put("mid", applicationInRecord.getMid());
paramForSplitInfo.put("newUnit", airUnit);
SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo);
// // 获取当前拆单记录与基础单位进制
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1L);
BigDecimal bg = new BigDecimal(mprice / splitInfoScaleQuantity * quantity);
amounts = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
applicationInRecord.setPrice(amounts);
String time = DateUtil.TimeStampToDateTime(ObjectFormatUtil.toLong(applicationInRecord.getApplicantTime()));
applicationInRecord.setApplicantName(userByPortById.getName());
applicationInRecord.setApplicantTime(time);
@ -4965,8 +4986,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
UserByPort userByPortById = null;
if (userByPortMap.containsKey(applicantId)) {
userByPortById = userByPortMap.get(applicantId);
}
else {
} else {
userByPortById = userService.findUserByIdForNoPack(applicantId);
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById);
userByPortById.setMaindeparmentname(departmentByUser.getName());
@ -5121,8 +5141,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
UserByPort userByPortById = null;
if (userByPortMap.containsKey(applicantId)) {
userByPortById = userByPortMap.get(applicantId);
}
else {
} else {
userByPortById = userService.findUserByIdForNoPack(applicantId);
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById);
userByPortById.setMaindeparmentname(departmentByUser.getName());

35
src/main/resources/templates/pages/depository/table-in.html

@ -97,7 +97,7 @@
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 新建</button>
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete"
<button class="layui-btn layui-btn-sm layui-btn-danger data-delete-btn" lay-event="delete" id="delete"
th:style="'display:'+${display}"> 删除
</button>
</div>
@ -152,6 +152,24 @@
};
let cols = [
{type: "checkbox", width: 50},
{field: "aircode", title: '申请编码', width: 250,},
{field: 'mname', width: 150, title: '物料名称'},
{field: 'mversion', width: 150, title: '规格型号'},
{field: 'airUnit', width: 100, title: '计量单位'},
{field: 'mcode', width: 150, title: '存货编码'},
{field: 'quantity', width: 100, title: '数量', sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'applicantName', width: 200, title: '提交人'},
{field: 'adminorgName', width: 150, title: '提交人部门'},
{field: 'applicantTime', width: 200, title: '提交时间', sort: true},
{field: 'applyRemark', width: 200, title: '备注'},
{field: 'airstate', width: 200, title: '状态'},
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"}
];
let flagForReload = true;
//日期
laydate.render({
elem: '#startDate',
@ -201,7 +219,7 @@
{field: 'mversion', width: 150, title: '规格型号'},
{field: 'airUnit', width: 100, title: '计量单位'},
{field: 'mcode', width: 150, title: '存货编码'},
{field: 'quantity', width: 150, title: '数量', sort: true},
{field: 'quantity', width: 100, title: '数量', sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'applicantName', width: 200, title: '提交人'},
{field: 'adminorgName', width: 150, title: '提交人部门'},
@ -215,7 +233,18 @@
limit: 15,
page: true,
skin: 'line',
done: function () {
done: function (res, curr, count) {
let display = $("#delete").css("display");
if (display !== "none") {
if (flagForReload) {
flagForReload = false;
let col1 = {field: 'price', title: '金额', width: 100, sort: true};
let col2 = {field: 'mprice', title: '单价', width: 100, sort: true};
cols.splice(7, 0, col2);
cols.splice(8, 0, col1);
table.reload('currentTableId', {cols: [cols]});
}
}
}
});

Loading…
Cancel
Save