库存日志

This commit is contained in:
sxu 2024-08-06 20:17:31 +08:00
parent c03995f514
commit e0a9901c59
5 changed files with 56 additions and 15 deletions

View File

@ -350,4 +350,7 @@ public class BackApplyInfo extends BaseEntity {
private String time; private String time;
private int viewWeb; private int viewWeb;
/** 操作后库存 */
private int postStoreNum;
} }

View File

@ -309,20 +309,20 @@ public class LogAspect
bmStorageLogList.add(bmStorageLog); bmStorageLogList.add(bmStorageLog);
} }
// 退料接收-完成退料 // 退料接收-完成退料
// if (joinPoint.getArgs()[0] instanceof BackApplyInfo) { if (joinPoint.getArgs()[0] instanceof BackApplyInfo) {
// BackApplyInfo bai = (BackApplyInfo)joinPoint.getArgs()[0]; BackApplyInfo bai = (BackApplyInfo)joinPoint.getArgs()[0];
// BmStorageLog bmStorageLog = new BmStorageLog(); BmStorageLog bmStorageLog = new BmStorageLog();
// bmStorageLog.setTaskId(String.valueOf(bai.getTaskId())); bmStorageLog.setTaskId(String.valueOf(bai.getTaskId()));
// bmStorageLog.setTypeId(Integer.parseInt(bai.getTypeId())); bmStorageLog.setTypeId(Integer.parseInt(bai.getTypeId()));
// bmStorageLog.setTypeName(bai.getMaCode()); bmStorageLog.setTypeName(bai.getMaCode());
// bmStorageLog.setPreStoreNum(Integer.parseInt(bai.getNum())); bmStorageLog.setPreStoreNum(Integer.parseInt(bai.getNum()));
// bmStorageLog.setBackNum(bai.getBackNum()); bmStorageLog.setBackNum(bai.getBackNum());
// bmStorageLog.setPassNum(bai.getPassNum()); bmStorageLog.setPassNum(bai.getPassNum());
// bmStorageLog.setMaintenanceNum(bai.getMaintenanceNum()); bmStorageLog.setMaintenanceNum(bai.getMaintenanceNum());
// bmStorageLog.setScrapNum(bai.getScrapNum()); bmStorageLog.setScrapNum(bai.getScrapNum());
// bmStorageLog.setPostStoreNum(bai.getPostStoreNum()); bmStorageLog.setPostStoreNum(bai.getPostStoreNum());
// bmStorageLogList.add(bmStorageLog); bmStorageLogList.add(bmStorageLog);
// } }
// 二级库出入库, 不影响ma_type库存变化暂时不加库存监控日志 // 二级库出入库, 不影响ma_type库存变化暂时不加库存监控日志
// if (joinPoint.getArgs()[0] instanceof TeamLeaseInfo) { // if (joinPoint.getArgs()[0] instanceof TeamLeaseInfo) {
// TeamLeaseInfo tli = (TeamLeaseInfo)joinPoint.getArgs()[0]; // TeamLeaseInfo tli = (TeamLeaseInfo)joinPoint.getArgs()[0];

View File

@ -77,6 +77,9 @@ public interface BackReceiveMapper {
*/ */
int updateMaStatus(@Param("maId") int maId,@Param("maStatus") String maStatus); int updateMaStatus(@Param("maId") int maId,@Param("maStatus") String maStatus);
int getmaChineByCt(BackApplyInfo record);
/** /**
* getHgList * getHgList
* @param record * @param record

View File

@ -146,6 +146,17 @@ public class BackReceiveServiceImpl implements BackReceiveService {
int res; int res;
// try { // try {
int taskId = record.getTaskId(); int taskId = record.getTaskId();
int passNum = 0;
int maintenanceNum = 0;
int scrapNum = 0;
List<BackApplyInfo> allList1 = backReceiveMapper.getAllList(record);
if (allList1 != null && allList1.size() > 0) {
BackApplyInfo b = allList1.get(0);
record.setTypeId(b.getTypeId());
int num = backReceiveMapper.getmaChineByCt(record);
record.setNum(String.valueOf(num));
}
//先判断是否已经完成退料了 //先判断是否已经完成退料了
int taskStatus = selectTaskStatus(taskId); int taskStatus = selectTaskStatus(taskId);
if (taskStatus == 0) { if (taskStatus == 0) {
@ -181,7 +192,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if (res == 0) { if (res == 0) {
throw new RuntimeException("ma_machines"); throw new RuntimeException("ma_machines");
} }
for (BackApplyInfo bi : hgList) {
passNum += bi.getBackNum();
}
} }
//维修的创建维修任务插入任务协议表 //维修的创建维修任务插入任务协议表
List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record); List<BackApplyInfo> wxList = backReceiveMapper.getWxList(record);
@ -192,6 +205,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
res = insertTta(newTaskId, wxList); res = insertTta(newTaskId, wxList);
//插入维修记录表repair_apply_details //插入维修记录表repair_apply_details
res = insertRad(newTaskId, wxList); res = insertRad(newTaskId, wxList);
for (BackApplyInfo bi : wxList) {
maintenanceNum += bi.getBackNum();
}
} }
//待报废的创建报废任务插入任务协议表 //待报废的创建报废任务插入任务协议表
@ -203,6 +219,9 @@ public class BackReceiveServiceImpl implements BackReceiveService {
res = insertTta(newTaskId, bfList); res = insertTta(newTaskId, bfList);
//插入维修记录表scrap_apply_details //插入维修记录表scrap_apply_details
res = insertSad(newTaskId, bfList); res = insertSad(newTaskId, bfList);
for (BackApplyInfo bi : bfList) {
scrapNum += bi.getBackNum();
}
} }
List<BackApplyInfo> allList = backReceiveMapper.getAllList(record); List<BackApplyInfo> allList = backReceiveMapper.getAllList(record);
@ -211,7 +230,18 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if (res == 0) { if (res == 0) {
throw new RuntimeException("该机具未被领料使用"); throw new RuntimeException("该机具未被领料使用");
} }
BackApplyInfo b = allList.get(0);
record.setTypeId(b.getTypeId());
int postStoreNum = backReceiveMapper.getmaChineByCt(record);
record.setPostStoreNum(postStoreNum);
} }
//库存日志
record.setBackNum(passNum+maintenanceNum+scrapNum);
record.setPassNum(passNum);
record.setMaintenanceNum(maintenanceNum);
record.setScrapNum(scrapNum);
// } catch (Exception e) { // } catch (Exception e) {
// throw new RuntimeException(e.getMessage()); // throw new RuntimeException(e.getMessage());
// } // }

View File

@ -695,9 +695,14 @@
</if> </if>
</select> </select>
<select id="getmaChineByCt" resultType="java.lang.Integer">
select num from ma_type WHERE type_id = #{typeId}
</select>
<select id="selectTaskNumByMonthWx" resultType="java.lang.Integer"> <select id="selectTaskNumByMonthWx" resultType="java.lang.Integer">
select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType} select count(*) from tm_task where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m') and task_type = #{taskType}
</select> </select>
<select id="getHgList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo"> <select id="getHgList" resultType="com.bonus.sgzb.base.api.domain.BackApplyInfo">
SELECT SELECT
tta.agreement_id as agreementId, tta.agreement_id as agreementId,