机具库存收藏修改

This commit is contained in:
jiang 2025-09-15 10:22:01 +08:00
parent 1e3b66e9e6
commit 7621de57f3
3 changed files with 311 additions and 314 deletions

View File

@ -679,67 +679,64 @@
<select id="findDetails" parameterType="com.bonus.ma.beans.MachineTypeBean" <select id="findDetails" parameterType="com.bonus.ma.beans.MachineTypeBean"
resultType="com.bonus.ma.beans.MachineTypeBean"> resultType="com.bonus.ma.beans.MachineTypeBean">
SELECT SELECT
DISTINCT DISTINCT
mat.ID AS id, mat.ID AS id,
mr.ORG_ID AS companyId, mr.ORG_ID AS companyId,
po.`NAME` AS po.`NAME` AS
companyName, companyName,
mat.`NAME`, mat.`NAME`,
mat2.`NAME` AS parentName, mat2.`NAME` AS parentName,
mat.UNIT AS unit, mat.UNIT AS unit,
mat.WEIGHT AS weight, mat.WEIGHT AS weight,
mat.RATED_LOAD AS ratedLoad, mat.RATED_LOAD AS ratedLoad,
mat.TEST_LOAD AS mat.TEST_LOAD AS
testLoad, testLoad,
mat.HOLDING_TIME AS holdingTime, mat.HOLDING_TIME AS holdingTime,
mat.LEASE_PRICE AS mat.LEASE_PRICE AS
leasePrice, leasePrice,
ROUND(CONVERT ( ( mat.PAY_PRICE ), DECIMAL ( 10, 2 ) )) AS ROUND(CONVERT ( ( mat.PAY_PRICE ), DECIMAL ( 10, 2 ) )) AS
payPrice, payPrice,
ROUND(mat.BUY_PRICE) AS buyPrice, ROUND(mat.BUY_PRICE) AS buyPrice,
mat.IS_COUNT AS isCount, mat.IS_COUNT AS isCount,
mat.FILE_URL AS fileUrl, mat.FILE_URL AS fileUrl,
ROUND(mat.NUM) AS nums, ROUND(mat.NUM) AS nums,
mat.SAMPING_RATIO AS mat.SAMPING_RATIO AS
sampingRatio, sampingRatio,
mat.WARN_NUM AS warnNum mat.WARN_NUM AS warnNum
FROM FROM
mm_type mat mm_type mat
LEFT JOIN LEFT JOIN
ma_org_relation mr ON mat.ID = mr.TYPE_ID ma_org_relation mr ON mat.ID = mr.TYPE_ID
LEFT JOIN pm_organization po LEFT JOIN pm_organization po
ON mr.ORG_ID = po.ID ON mr.ORG_ID = po.ID
LEFT JOIN mm_type mat2 ON mat2.ID = mat.PARENT_ID LEFT JOIN mm_type mat2 ON mat2.ID = mat.PARENT_ID
LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID LEFT JOIN mm_type mat3 ON mat3.ID = mat2.PARENT_ID
LEFT JOIN mm_type LEFT JOIN mm_type
mat4 ON mat4.ID = mat3.PARENT_ID mat4 ON mat4.ID = mat3.PARENT_ID
WHERE WHERE
mat4.PARENT_ID = 0 mat4.PARENT_ID = 0
AND AND
mat.IS_ACTIVE = '1' mat.IS_ACTIVE = '1'
AND mat2.IS_ACTIVE = '1' AND mat2.IS_ACTIVE = '1'
AND mat3.IS_ACTIVE = '1' AND mat3.IS_ACTIVE = '1'
AND mat4.IS_ACTIVE = '1' AND mat4.IS_ACTIVE = '1'
and mat.PARENT_ID = #{param.parentId} and mat.PARENT_ID = #{param.parentId}
<if test="param.companyId != 1 and param.companyId != '1'"> <if test="param.keyWord != null and param.keyWord != ''">
and mr.ORG_ID = #{param.companyId} and (
</if> mat.`NAME` like CONCAT('%',#{param.keyWord},'%') or
<if test="param.keyWord != null and param.keyWord != ''"> mat.WEIGHT like CONCAT('%',#{param.keyWord},'%') or
and ( mat.LEASE_PRICE
mat.`NAME` like CONCAT('%',#{param.keyWord},'%') or like CONCAT('%',#{param.keyWord},'%') or
mat.WEIGHT like CONCAT('%',#{param.keyWord},'%') or mat.PAY_PRICE like
mat.LEASE_PRICE CONCAT('%',#{param.keyWord},'%') or
like CONCAT('%',#{param.keyWord},'%') or mat.BUY_PRICE like
mat.PAY_PRICE like CONCAT('%',#{param.keyWord},'%')
CONCAT('%',#{param.keyWord},'%') or )
mat.BUY_PRICE like </if>
CONCAT('%',#{param.keyWord},'%') GROUP BY mat.ID,mr.ORG_ID
) </select>
</if>
GROUP BY mat.ID,mr.ORG_ID
</select>
<select id="findModel" parameterType="com.bonus.ma.beans.MachineTypeBean" <select id="findModel" parameterType="com.bonus.ma.beans.MachineTypeBean"
resultType="com.bonus.ma.beans.MachineTypeBean"> resultType="com.bonus.ma.beans.MachineTypeBean">

View File

@ -77,18 +77,18 @@ public class ProjectManageController extends BaseController<ProjectManageBean> {
} }
// 2. 时间戳校验防重放 // 2. 时间戳校验防重放
try { // try {
Date time = DateUtil.parse(timestamp, "yyyyMMddHHmmss"); // Date time = DateUtil.parse(timestamp, "yyyyMMddHHmmss");
long diff = Math.abs(System.currentTimeMillis() - time.getTime()); // long diff = Math.abs(System.currentTimeMillis() - time.getTime());
if (diff > 5 * 60 * 1000) { // if (diff > 5 * 60 * 1000) {
result.setFailMsg("请求时间戳不合法!!"); // result.setFailMsg("请求时间戳不合法!!");
return result; // return result;
} // }
} catch (Exception e) { // } catch (Exception e) {
System.err.println("时间戳解析异常:" + timestamp + "," + e.getMessage()); // System.err.println("时间戳解析异常:" + timestamp + "," + e.getMessage());
result.setFailMsg("时间戳解析异常"); // result.setFailMsg("时间戳解析异常");
return result; // return result;
} // }
// 3. 验证签名 // 3. 验证签名
String baseSign = appId + timestamp + encryptedData + appSecret; String baseSign = appId + timestamp + encryptedData + appSecret;

View File

@ -15,262 +15,262 @@ import com.bonus.sys.BaseServiceImp;
@Service("returnMaterialDetails") @Service("returnMaterialDetails")
public class ReturnMaterialDetailsServiceImp extends BaseServiceImp<ReturnMaterialDetailsBean> public class ReturnMaterialDetailsServiceImp extends BaseServiceImp<ReturnMaterialDetailsBean>
implements ReturnMaterialDetailsService { implements ReturnMaterialDetailsService {
@Autowired @Autowired
ReturnMaterialDetailsDao dao; ReturnMaterialDetailsDao dao;
@Autowired @Autowired
MachineDao mdao; MachineDao mdao;
@Override @Override
public Object findByCode(ReturnMaterialDetailsBean o) { public Object findByCode(ReturnMaterialDetailsBean o) {
// 查询退料详细 // 查询退料详细
List<ReturnMaterialDetailsBean> back = dao.findByTaskId(o); List<ReturnMaterialDetailsBean> back = dao.findByTaskId(o);
String unitId = ""; String unitId = "";
String workId = ""; String workId = "";
if (back.size() > 0) { if (back.size() > 0) {
unitId = back.get(0).getUnitId(); unitId = back.get(0).getUnitId();
workId = back.get(0).getWorkId(); workId = back.get(0).getWorkId();
} }
// 查询领料信息 // 查询领料信息
List<ReturnMaterialDetailsBean> receive = dao.findByCode(o); List<ReturnMaterialDetailsBean> receive = dao.findByCode(o);
String reUnitId = ""; String reUnitId = "";
String reProjectId = ""; String reProjectId = "";
String batchStatus = ""; String batchStatus = "";
if (receive.size() > 0) { if (receive.size() > 0) {
reUnitId = receive.get(0).getReceiveUnitId(); reUnitId = receive.get(0).getReceiveUnitId();
reProjectId = receive.get(0).getReceiveProjectId(); reProjectId = receive.get(0).getReceiveProjectId();
batchStatus = receive.get(0).getBatchStatus(); batchStatus = receive.get(0).getBatchStatus();
if ("6".equals(batchStatus)) { if ("6".equals(batchStatus)) {
if (unitId.equals(reUnitId) && workId.equals(reProjectId)) { if (unitId.equals(reUnitId) && workId.equals(reProjectId)) {
return "1"; return "1";
} else { } else {
return receive; return receive;
} }
} else { } else {
return "-2"; return "-2";
} }
} else { } else {
return "-1"; return "-1";
} }
} }
// 退料接收 // 退料接收
@Override @Override
public Object receiveDevice(ReturnMaterialDetailsBean o) { public Object receiveDevice(ReturnMaterialDetailsBean o) {
// 1-修改机具状态 // 1-修改机具状态
MachineBean ma = new MachineBean(); MachineBean ma = new MachineBean();
ma.setId(o.getMaId()); ma.setId(o.getMaId());
List<MachineBean> mList = mdao.find(ma); List<MachineBean> mList = mdao.find(ma);
String batchStatus = mList.get(0).getBatchStatus(); String batchStatus = mList.get(0).getBatchStatus();
if ("6".equals(batchStatus)) { if ("6".equals(batchStatus)) {
int updRes = updDevice(o); int updRes = updDevice(o);
if (updRes == 1) { if (updRes == 1) {
// 2-添加退料明细 // 2-添加退料明细
int detailsRes = rmDetails(o); int detailsRes = rmDetails(o);
return detailsRes; return detailsRes;
} else { } else {
return -1; return -1;
} }
} else { } else {
return -1; return -1;
} }
} }
public int updDevice(ReturnMaterialDetailsBean o) { public int updDevice(ReturnMaterialDetailsBean o) {
MachineBean bean = new MachineBean(); MachineBean bean = new MachineBean();
bean.setId(o.getMaId()); bean.setId(o.getMaId());
bean.setBatchStatus(o.getBatchStatus()); bean.setBatchStatus(o.getBatchStatus());
try { try {
mdao.updateBatchStatus(bean); mdao.updateBatchStatus(bean);
return 1; return 1;
} catch (Exception e) { } catch (Exception e) {
return -1; return -1;
} }
} }
public int rmDetails(ReturnMaterialDetailsBean o) { public int rmDetails(ReturnMaterialDetailsBean o) {
MachineBean ma = new MachineBean(); MachineBean ma = new MachineBean();
ma.setId(o.getMaId()); ma.setId(o.getMaId());
List<MachineBean> list = mdao.find(ma); List<MachineBean> list = mdao.find(ma);
String modelId = ""; String modelId = "";
try { try {
if (list.size() == 1) { if (list.size() == 1) {
modelId = list.get(0).getTypeId(); modelId = list.get(0).getTypeId();
o.setModelId(modelId); o.setModelId(modelId);
// 1-查询是否存在明细任务 // 1-查询是否存在明细任务
// 2-存在则获取任务ID存入详细表 // 2-存在则获取任务ID存入详细表
// 3-不存在则新增明细任务并存入详细表 // 3-不存在则新增明细任务并存入详细表
String supId = dao.findSupId(o); String supId = dao.findSupId(o);
if (supId == "" || supId == null) { if (supId == "" || supId == null) {
o.setReturnMaterialTime(DateTimeHelper.getNowTime()); o.setReturnMaterialTime(DateTimeHelper.getNowTime());
o.setOperationTime(DateTimeHelper.getNowTime()); o.setOperationTime(DateTimeHelper.getNowTime());
dao.insert(o); dao.insert(o);
int infoRes = rmInfo(o); int infoRes = rmInfo(o);
if (infoRes == 1) { if (infoRes == 1) {
return 1; return 1;
} else { } else {
return -1; return -1;
} }
} else { } else {
// 3-添加退料详情 // 3-添加退料详情
o.setSupId(supId); o.setSupId(supId);
o.setOperationTime(DateTimeHelper.getNowTime()); o.setOperationTime(DateTimeHelper.getNowTime());
int infoRes = rmInfo(o); int infoRes = rmInfo(o);
if (infoRes == 1) { if (infoRes == 1) {
return 1; return 1;
} else { } else {
return -1; return -1;
} }
} }
} else if (list.size() > 1) { } else if (list.size() > 1) {
// 设备编号重复 // 设备编号重复
return -2; return -2;
} else { } else {
// 设备编号重不存在 // 设备编号重不存在
return 0; return 0;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return -1; return -1;
} }
} }
public int rmInfo(ReturnMaterialDetailsBean o) { public int rmInfo(ReturnMaterialDetailsBean o) {
MachineBean ma = new MachineBean(); MachineBean ma = new MachineBean();
ma.setId(o.getMaId()); ma.setId(o.getMaId());
List<MachineBean> list = mdao.find(ma); List<MachineBean> list = mdao.find(ma);
String modelId = ""; String modelId = "";
String maId = ""; String maId = "";
try { try {
if (list.size() == 1) { if (list.size() == 1) {
modelId = list.get(0).getTypeId(); modelId = list.get(0).getTypeId();
maId = list.get(0).getId(); maId = list.get(0).getId();
o.setModelId(modelId); o.setModelId(modelId);
o.setMaId(maId); o.setMaId(maId);
o.setOperationTime(DateTimeHelper.getNowTime()); o.setOperationTime(DateTimeHelper.getNowTime());
o.setMaNum("1"); o.setMaNum("1");
o.setState("4"); o.setState("4");
dao.insertInfo(o); dao.insertInfo(o);
return 1; return 1;
} else if (list.size() > 1) { } else if (list.size() > 1) {
// 设备编号重复 // 设备编号重复
return -2; return -2;
} else { } else {
// 设备编号重不存在 // 设备编号重不存在
return 0; return 0;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return -1; return -1;
} }
} }
@Override @Override
public Object findLeaseBackNum(ReturnMaterialDetailsBean o) { public Object findLeaseBackNum(ReturnMaterialDetailsBean o) {
return dao.findLeaseBackNum(o); return dao.findLeaseBackNum(o);
} }
@Override @Override
public Object reBackNums(ReturnMaterialDetailsBean o) { public Object reBackNums(ReturnMaterialDetailsBean o) {
int detailsRes = addRmTask(o); int detailsRes = addRmTask(o);
return detailsRes; return detailsRes;
} }
/** /**
* 数量退料接收 * 数量退料接收
*/ */
public int addRmTask(ReturnMaterialDetailsBean o) { public int addRmTask(ReturnMaterialDetailsBean o) {
// 1-查询是否存在明细任务 // 1-查询是否存在明细任务
// 2-存在则获取任务ID存入详细表 // 2-存在则获取任务ID存入详细表
// 3-不存在则新增明细任务并存入详细表 // 3-不存在则新增明细任务并存入详细表
try { try {
String supId = dao.findSupId(o); String supId = dao.findSupId(o);
if (StringHelper.isEmpty(supId) || supId == null) { if (StringHelper.isEmpty(supId) || supId == null) {
o.setReturnMaterialTime(DateTimeHelper.getNowTime()); o.setReturnMaterialTime(DateTimeHelper.getNowTime());
o.setOperationTime(DateTimeHelper.getNowTime()); o.setOperationTime(DateTimeHelper.getNowTime());
dao.insert(o); dao.insert(o);
// 3-添加退料详情 // 3-添加退料详情
if (StringHelper.isNotEmpty(o.getNum()) && !"0".equals(o.getNum())) {// 合格 if (StringHelper.isNotEmpty(o.getNum()) && !"0".equals(o.getNum())) {// 合格
o.setMaNum(o.getNum()); o.setMaNum(o.getNum());
o.setRmStatus("1"); o.setRmStatus("1");
int infoRes = addNumInfo(o); int infoRes = addNumInfo(o);
if (infoRes != 1) { if (infoRes != 1) {
return -1; return -1;
} }
} }
if (StringHelper.isNotEmpty(o.getRepairNum()) && !"0".equals(o.getRepairNum())) {// 维修 if (StringHelper.isNotEmpty(o.getRepairNum()) && !"0".equals(o.getRepairNum())) {// 维修
o.setMaNum(o.getRepairNum()); o.setMaNum(o.getRepairNum());
o.setRmStatus("2"); o.setRmStatus("2");
int infoRes = addNumInfo(o); int infoRes = addNumInfo(o);
if (infoRes != 1) { if (infoRes != 1) {
return -1; return -1;
} }
} }
if (StringHelper.isNotEmpty(o.getScrapNum()) && !"0".equals(o.getScrapNum())) {// 报废 if (StringHelper.isNotEmpty(o.getScrapNum()) && !"0".equals(o.getScrapNum())) {// 报废
o.setMaNum(o.getScrapNum()); o.setMaNum(o.getScrapNum());
o.setRmStatus("3"); o.setRmStatus("3");
int infoRes = addNumInfo(o); int infoRes = addNumInfo(o);
if (infoRes != 1) { if (infoRes != 1) {
return -1; return -1;
} }
} }
} else { } else {
// 3-添加退料详情 // 3-添加退料详情
o.setSupId(supId); o.setSupId(supId);
o.setOperationTime(DateTimeHelper.getNowTime()); o.setOperationTime(DateTimeHelper.getNowTime());
if (StringHelper.isNotEmpty(o.getNum()) && !"0".equals(o.getNum())) { if (StringHelper.isNotEmpty(o.getNum()) && !"0".equals(o.getNum())) {
o.setMaNum(o.getNum()); o.setMaNum(o.getNum());
o.setRmStatus("1"); o.setRmStatus("1");
int infoRes = addNumInfo(o); int infoRes = addNumInfo(o);
if (infoRes != 1) { if (infoRes != 1) {
return -1; return -1;
} }
} }
if (StringHelper.isNotEmpty(o.getRepairNum()) && !"0".equals(o.getRepairNum())) { if (StringHelper.isNotEmpty(o.getRepairNum()) && !"0".equals(o.getRepairNum())) {
o.setMaNum(o.getRepairNum()); o.setMaNum(o.getRepairNum());
o.setRmStatus("2"); o.setRmStatus("2");
int infoRes = addNumInfo(o); int infoRes = addNumInfo(o);
if (infoRes != 1) { if (infoRes != 1) {
return -1; return -1;
} }
} }
if (StringHelper.isNotEmpty(o.getScrapNum()) && !"0".equals(o.getScrapNum())) { if (StringHelper.isNotEmpty(o.getScrapNum()) && !"0".equals(o.getScrapNum())) {
o.setMaNum(o.getScrapNum()); o.setMaNum(o.getScrapNum());
o.setRmStatus("3"); o.setRmStatus("3");
int infoRes = addNumInfo(o); int infoRes = addNumInfo(o);
if (infoRes != 1) { if (infoRes != 1) {
return -1; return -1;
} }
} }
} }
return 1; return 1;
} catch (Exception e) { } catch (Exception e) {
return -1; return -1;
} }
} }
public int addNumInfo(ReturnMaterialDetailsBean o) { public int addNumInfo(ReturnMaterialDetailsBean o) {
try { try {
o.setState("4"); o.setState("4");
dao.insertInfo(o); dao.insertInfo(o);
return 1; return 1;
} catch (Exception e) { } catch (Exception e) {
return -1; return -1;
} }
} }
@Override @Override
public List<ReturnMaterialDetailsBean> findTaskDetail(ReturnMaterialDetailsBean o) { public List<ReturnMaterialDetailsBean> findTaskDetail(ReturnMaterialDetailsBean o) {
return dao.findTaskDetail(o); return dao.findTaskDetail(o);
} }
@Override @Override
public List<ReturnMaterialDetailsBean> findTaskDetailInfo(ReturnMaterialDetailsBean o) { public List<ReturnMaterialDetailsBean> findTaskDetailInfo(ReturnMaterialDetailsBean o) {
return dao.findTaskDetailInfo(o); return dao.findTaskDetailInfo(o);
} }
} }