成套机具代码提交

This commit is contained in:
liang.chao 2024-04-24 17:59:17 +08:00
parent 4af501532f
commit 3ac38557af
3 changed files with 29 additions and 5 deletions

View File

@ -200,4 +200,6 @@ public interface BackReceiveMapper {
int selectTaskStatus(int taskId);
BackApplyInfo backReceiveRecordWeb(BackApplyInfo record);
List<BackApplyInfo> getCtList(BackApplyInfo record);
}

View File

@ -44,7 +44,8 @@ public class BackReceiveServiceImpl implements BackReceiveService {
@Override
public List<BackApplyInfo> receiveView(BackApplyInfo record) {
List<BackApplyInfo> backApplyInfoList = backReceiveMapper.receiveView(record);
int machinePartNum = 0;
int count1 = 0;
int count2 = 0;
for (BackApplyInfo backApplyInfo : backApplyInfoList) {
if ("2".equals(backApplyInfo.getManageType())) {
List<MachinePart> machineParts = new ArrayList<>();
@ -54,13 +55,14 @@ public class BackReceiveServiceImpl implements BackReceiveService {
MachinePart machinePart = tmTaskMapper.getMachineParts(typeId);
machinePart.setParentId(record.getId());
int countMachineByPidAndTid = tmTaskMapper.getCountMachineByPidAndTid(machinePart);
machinePartNum = typeId.getPartNum() * (int) Double.parseDouble(backApplyInfo.getPreNum());
int machinePartNum = typeId.getPartNum() * (int) Double.parseDouble(backApplyInfo.getPreNum());
count1 += machinePartNum;
count2 += countMachineByPidAndTid;
machinePart.setPartNum(machinePartNum - countMachineByPidAndTid);
machineParts.add(machinePart);
}
backApplyInfo.setMaTypeDetails(machineParts);
int countMachine = tmTaskMapper.getCountMachine(record);
if (countMachine == machinePartNum) {
if (count1 == count2) {
backApplyInfo.setPartNum(0);
} else {
backApplyInfo.setPartNum((int) Double.parseDouble(backApplyInfo.getPreNum()));
@ -162,6 +164,15 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if (res == 0) {
throw new RuntimeException("input_apply_details");
}
// 如果是成套的机具成套机具的库存也要添加
List<BackApplyInfo> ctList = backReceiveMapper.getCtList(record);
if (ctList.size() > 0) {
for (BackApplyInfo backApplyInfo : ctList) {
if ("2".equals(backApplyInfo.getManageType())) {
backReceiveMapper.updateMt(backApplyInfo);
}
}
}
res = updateMt(hgList);
if (res == 0) {
throw new RuntimeException("ma_type");

View File

@ -665,7 +665,7 @@
mt.type_name as typeCode,
mt.unit_name as unitName,
mt2.type_name AS typeName,
bad.pre_num as preNum,
bad.audit_num as preNum,
bad.status as status,
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
mt.manage_type as manageType,
@ -984,5 +984,16 @@
ORDER BY
bcd.create_time DESC
</select>
<select id="getCtList" resultType="com.bonus.sgzb.app.domain.BackApplyInfo">
SELECT
bad.type_id as typeId,
ifnull(bad.audit_num,0) as backNum,
mt.manage_type as manageType
FROM
back_apply_details bad
LEFT JOIN ma_type mt ON bad.type_id = mt.type_id
WHERE
bad.parent_id = #{parentId}
</select>
</mapper>