Compare commits

...

2 Commits

Author SHA1 Message Date
dingjie 8857257ec1 Merge remote-tracking branch 'origin/dev' into dev 2023-12-23 14:32:05 +08:00
dingjie c1075c9320 新购入库模块代码修改 2023-12-23 14:31:54 +08:00
14 changed files with 70 additions and 88 deletions

View File

@ -1,4 +1,4 @@
package com.bonus.sgzb.base.domain;
package com.bonus.sgzb.base.api.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.bonus.sgzb.common.core.web.domain.BaseEntity;

View File

@ -2,7 +2,7 @@ package com.bonus.sgzb.base.controller;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.base.service.IMaMachineLabelService;
import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;

View File

@ -1,6 +1,6 @@
package com.bonus.sgzb.base.mapper;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;

View File

@ -1,8 +1,6 @@
package com.bonus.sgzb.base.service;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import java.util.List;

View File

@ -1,6 +1,6 @@
package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.base.mapper.MaMachineLabelMapper;
import com.bonus.sgzb.base.service.IMaMachineLabelService;
import com.bonus.sgzb.common.core.utils.DateUtils;

View File

@ -92,8 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select mt.type_name specificationType, mt1.type_name machineTypeName, mt2.type_name itemType ,
mm.ma_code maCode, mhs.house_id, mhs.type_id, mhs.ma_id, mhs.num, mhs.status, mhs.dept_id, mhs.del_flag,
mhs.create_by, mhs.create_time, mhs.update_by,mhs.update_time,mhs.remark,mhs.company_id
from ma_type mt
left join ma_machine mm on mt.type_id = mm.type_id
from ma_machine mm
left join ma_type mt on mm.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
left join ma_type mt2 on mt1.parent_id = mt2.type_id
left join ma_house_set mhs on mt.type_id = mhs.type_id

View File

@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.base.mapper.MaMachineLabelMapper">
<resultMap type="com.bonus.sgzb.base.domain.MaMachineLabel" id="MaMachineLabelResult">
<resultMap type="com.bonus.sgzb.base.api.domain.MaMachineLabel" id="MaMachineLabelResult">
<result property="labelId" column="label_id" />
<result property="labelCode" column="label_code" />
<result property="maId" column="ma_id" />
@ -16,7 +16,7 @@
select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label
</sql>
<select id="selectMaMachineLabelList" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" resultMap="MaMachineLabelResult">
<select id="selectMaMachineLabelList" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" resultMap="MaMachineLabelResult">
select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label
where is_bind ='0'
@ -26,7 +26,7 @@
from ma_machine_label
where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m')
</select>
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId">
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId">
insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="labelCode != null">label_code,</if>

View File

@ -86,21 +86,6 @@ public class PurchaseMacodeInfoController extends BaseController
return purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfoList);
}
/**
* 生成设备编号
*/
@ApiOperation(value = "生成设备编号")
@PostMapping("/equipmentNumber")
public AjaxResult generateEquipmentNumber(@RequestBody EquipmentNumberVO equipmentNumberVO) throws Exception {
Long typeId = equipmentNumberVO.getTypeId();
if (typeId == null) {
throw new Exception("类型typeId为空!");
}
if (equipmentNumberVO.getCount() == 0) {
throw new Exception("生成数量为0!");
}
return success(purchaseMacodeInfoService.generateEquipmentNumber(equipmentNumberVO));
}
/**
* 修改新购验收编号管理
@ -112,7 +97,7 @@ public class PurchaseMacodeInfoController extends BaseController
}
/**
* 修改新购验收编号管理
* 修改新购验收编号管理,暂时不用
*/
@ApiOperation(value = "修改编码管理的入库状态")
@PutMapping("/manageStatus")

View File

@ -2,6 +2,7 @@ package com.bonus.sgzb.material.mapper;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.domain.PurchaseMacodeInfo;
@ -102,4 +103,8 @@ public interface PurchaseMacodeInfoMapper {
int selectMaCode(String maCode);
int updateMacodeByType(PurchaseMacodeInfo purchaseMacodeInfo);
int selectLableNumByMonth(Date nowDate);
int insertMaMachineLabel(MaMachineLabel maMachineLabel);
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.service;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.MaInputRecord;
import com.bonus.sgzb.material.domain.PurchaseMacodeInfo;
@ -65,7 +66,7 @@ public interface IPurchaseMacodeInfoService
*/
public int deletePurchaseMacodeInfoByTaskId(Long taskId);
JSONObject generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO);
String generateEquipmentNumber(MaMachineLabel maMachineLabel);
int deletePurchaseMacodeInfoById(Long id);

View File

@ -8,6 +8,7 @@ import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaMachine;
import com.bonus.sgzb.base.api.domain.MaMachineLabel;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils;
@ -99,11 +100,15 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
String maCode = purchaseMacodeInfo.getMaCode();
purchaseCheckDetails.setTypeId(typeId);
purchaseCheckDetails.setTaskId(purchaseMacodeInfo.getTaskId());
MaMachineLabel maLabel = new MaMachineLabel();
String qrCode = generateEquipmentNumber(maLabel);
if (StringUtils.isNotEmpty(maCode)) {
MaMachine maMachine = new MaMachine();
maMachine.setTypeId(typeId);
maMachine.setMaStatus("14");
maMachine.setQrCode(purchaseMacodeInfo.getQrCode());
maMachine.setQrCode(qrCode);
// 设备原厂编号
String fixCode = purchaseMacodeInfo.getFixCode();
if ("0".equals(fixCode)) {
@ -118,16 +123,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
maMachine.setCreateBy(SecurityUtils.getUsername());
purchaseMacodeInfoMapper.maMachineAdd(maMachine);
}
String qrCode = purchaseMacodeInfo.getQrCode();
// 二维码存储
if (StringUtils.isNotEmpty(qrCode)) {
BmQrcodeInfo bmQrcodeInfo = new BmQrcodeInfo();
bmQrcodeInfo.setTypeId(typeId);
bmQrcodeInfo.setQrCode(qrCode);
bmQrcodeInfo.setTaskId(purchaseMacodeInfo.getTaskId());
bmQrcodeInfo.setCreateTime(new Date());
qrcodeInfoMapper.insertBmQrcodeInfo(bmQrcodeInfo);
}
purchaseMacodeInfo.setStatus("0");
purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate());
purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo);
@ -215,55 +211,27 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/**
* 生成设备编号
*
* @param equipmentNumberVO 类型id,生成数量
* @param maMachineLabel 类型id,生成数量
* @return 编码结果
*/
@Override
public JSONObject generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO) {
Long typeId = equipmentNumberVO.getTypeId();
SimpleDateFormat sdf = new SimpleDateFormat("yyMM");
public String generateEquipmentNumber(MaMachineLabel maMachineLabel) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = sdf.format(nowDate);
JSONObject jsonObject = purchaseMacodeInfoMapper.getTypeByTypeId(typeId);
String typeCode = jsonObject.getString("modelCode");
String specsCode = jsonObject.getString("specsCode");
//序列号
int count = purchaseMacodeInfoMapper.getSerialNumber(typeId, nowDate) + 1;
List<String> list = new ArrayList<>();
List<String> codeList = new ArrayList<>();
for (int i = 0; i < equipmentNumberVO.getCount(); i++) {
int i1 = count + i;
// 编码规则
String codingRule = "NSJJ" + specsCode + format + typeCode;
String codeNum = "";
String code = format;
String code1 = format;
if (i1 > 9 && i1 < 100) {
codeNum = "-00" + i1;
code1 = "-00" + i1;
} else if (i1 > 99 && i1 < 1000) {
codeNum = "-0" + i1;
code1 = "-0" + i1;
} else {
codeNum = "-000" + i1;
code1 = "-000" + i1;
}
codingRule = codingRule + codeNum;
code = code + code1;
// 二维码
int i2 = purchaseMacodeInfoMapper.selectMachineByMaCode(codingRule);
if (i2 <= 0) {
list.add(codingRule);
}
codeList.add(code);
String format = dateFormat.format(nowDate);
int lableNum = purchaseMacodeInfoMapper.selectLableNumByMonth(nowDate) + 1;
String code="";
if (lableNum>9 && lableNum<100){
code = format + "-00" + lableNum;
}else if (lableNum>99 && lableNum<1000){
code = format + "-0" + lableNum;
}else {
code = format + "-000" + lableNum;
}
JSONObject result = new JSONObject();
result.put("equipmentNum", list);
result.put("twoDimensionalCode", codeList);
return result;
maMachineLabel.setIsBind("0");
maMachineLabel.setLabelCode(code);
purchaseMacodeInfoMapper.insertMaMachineLabel(maMachineLabel);
return code;
}
/**
@ -278,7 +246,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
}
/**
* 修改编码管理的入库状态
* 修改编码管理的入库状态,暂时不用
*
* @param maInputVO 入库信息
* @return 结果

View File

@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join tm_task tk on pci.task_id = tk.task_id
left join (select id,name from sys_dic where p_id = 23) dict on tk.task_status = dict.id
left join sys_user su on pci.purchaser = su.user_id
where task_type = 23 and tk.task_status in (24,25,26,27)
where task_type = 23
<if test="purchaseTime != null and purchaseTime != ''"> and tk.code = #{code}</if>
<if test="purchaseTime != null and purchaseTime != ''"> and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null and arrivalTime != ''"> and pci.arrival_time = #{arrivalTime}</if>

View File

@ -235,6 +235,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null">#{companyId},</if>
</trim>
</insert>
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId">
insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="labelCode != null">label_code,</if>
<if test="maId != null">ma_id,</if>
<if test="isBind != null">is_bind,</if>
<if test="labelType != null">label_type,</if>
<if test="companyId != null">company_id,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="labelCode != null">#{labelCode},</if>
<if test="maId != null">#{maId},</if>
<if test="isBind != null">#{isBind},</if>
<if test="labelType != null">#{labelType},</if>
<if test="companyId != null">#{companyId},</if>
now()
</trim>
</insert>
<select id="selectTypeByTypeId" resultType="com.bonus.sgzb.base.api.domain.MaType">
select type_id typeId, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price,
@ -260,7 +279,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPutinDetails" resultType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo">
select pcd.production_time productionTime,mt.type_name specificationType, mt1.type_name typeName, pmi.ma_code maCode,
mm.assets_code assetsCode ,pmi.fix_code fixCode,pcd.type_id typeId,pcd.task_id taskId, mt.code specsCode,mt1.code typeCode,
if(pmi.ma_code is null, if(pcd.status != 4, 0 , 1), pmi.status) status,
if(pmi.ma_code is null, if(pcd.status != 4, 0 , 1), pmi.status) status,mm.qr_code qrCode,
if(pmi.ma_code is not null,1,pcd.check_num) checkNum
from purchase_check_details pcd
left join purchase_macode_info pmi on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
@ -268,10 +287,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id
where pcd.task_id = #{taskId}
order by status
</select>
<select id="selectMaCode" resultType="java.lang.Integer">
select count(ma_id) from ma_machine where ma_code = #{maCode}
</select>
<select id="selectLableNumByMonth" resultType="java.lang.Integer">
select count(*)
from ma_machine_label
where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m')
</select>
<update id="updateTypeByTypeId">
update ma_type set num = #{num} where type_id = #{typeId}

View File

@ -123,5 +123,5 @@
</plugin>
</plugins>
</build>
</project>