Compare commits

..

No commits in common. "8857257ec1467a1fc1341e905f705b51c77e328e" and "eab80f6156e37c1a7e908644f59bd711a0040120" have entirely different histories.

14 changed files with 88 additions and 70 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
package com.bonus.sgzb.base.service.impl; package com.bonus.sgzb.base.service.impl;
import com.bonus.sgzb.base.api.domain.MaMachineLabel; import com.bonus.sgzb.base.domain.MaMachineLabel;
import com.bonus.sgzb.base.mapper.MaMachineLabelMapper; import com.bonus.sgzb.base.mapper.MaMachineLabelMapper;
import com.bonus.sgzb.base.service.IMaMachineLabelService; import com.bonus.sgzb.base.service.IMaMachineLabelService;
import com.bonus.sgzb.common.core.utils.DateUtils; 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 , 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, 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 mhs.create_by, mhs.create_time, mhs.update_by,mhs.update_time,mhs.remark,mhs.company_id
from ma_machine mm from ma_type mt
left join ma_type mt on mm.type_id = mt.type_id left join ma_machine mm on mt.type_id = mm.type_id
left join ma_type mt1 on mt.parent_id = mt1.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_type mt2 on mt1.parent_id = mt2.type_id
left join ma_house_set mhs on mt.type_id = mhs.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"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.sgzb.base.mapper.MaMachineLabelMapper"> <mapper namespace="com.bonus.sgzb.base.mapper.MaMachineLabelMapper">
<resultMap type="com.bonus.sgzb.base.api.domain.MaMachineLabel" id="MaMachineLabelResult"> <resultMap type="com.bonus.sgzb.base.domain.MaMachineLabel" id="MaMachineLabelResult">
<result property="labelId" column="label_id" /> <result property="labelId" column="label_id" />
<result property="labelCode" column="label_code" /> <result property="labelCode" column="label_code" />
<result property="maId" column="ma_id" /> <result property="maId" column="ma_id" />
@ -16,7 +16,7 @@
select label_id, label_code, ma_id, is_bind, label_type, company_id select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label from ma_machine_label
</sql> </sql>
<select id="selectMaMachineLabelList" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" resultMap="MaMachineLabelResult"> <select id="selectMaMachineLabelList" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" resultMap="MaMachineLabelResult">
select label_id, label_code, ma_id, is_bind, label_type, company_id select label_id, label_code, ma_id, is_bind, label_type, company_id
from ma_machine_label from ma_machine_label
where is_bind ='0' where is_bind ='0'
@ -26,7 +26,7 @@
from ma_machine_label from ma_machine_label
where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m') where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{nowDate},'%y%m')
</select> </select>
<insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.api.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId"> <insert id="insertMaMachineLabel" parameterType="com.bonus.sgzb.base.domain.MaMachineLabel" useGeneratedKeys="true" keyProperty="labelId">
insert into ma_machine_label insert into ma_machine_label
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="labelCode != null">label_code,</if> <if test="labelCode != null">label_code,</if>

View File

@ -86,6 +86,21 @@ public class PurchaseMacodeInfoController extends BaseController
return purchaseMacodeInfoService.insertPurchaseMacodeInfo(purchaseMacodeInfoList); 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));
}
/** /**
* 修改新购验收编号管理 * 修改新购验收编号管理
@ -97,7 +112,7 @@ public class PurchaseMacodeInfoController extends BaseController
} }
/** /**
* 修改新购验收编号管理,暂时不用 * 修改新购验收编号管理
*/ */
@ApiOperation(value = "修改编码管理的入库状态") @ApiOperation(value = "修改编码管理的入库状态")
@PutMapping("/manageStatus") @PutMapping("/manageStatus")

View File

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

View File

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

View File

@ -8,7 +8,6 @@ import java.util.List;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaMachine; 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.MaType;
import com.bonus.sgzb.base.api.domain.TmTask; import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.utils.StringUtils;
@ -100,15 +99,11 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
String maCode = purchaseMacodeInfo.getMaCode(); String maCode = purchaseMacodeInfo.getMaCode();
purchaseCheckDetails.setTypeId(typeId); purchaseCheckDetails.setTypeId(typeId);
purchaseCheckDetails.setTaskId(purchaseMacodeInfo.getTaskId()); purchaseCheckDetails.setTaskId(purchaseMacodeInfo.getTaskId());
MaMachineLabel maLabel = new MaMachineLabel();
String qrCode = generateEquipmentNumber(maLabel);
if (StringUtils.isNotEmpty(maCode)) { if (StringUtils.isNotEmpty(maCode)) {
MaMachine maMachine = new MaMachine(); MaMachine maMachine = new MaMachine();
maMachine.setTypeId(typeId); maMachine.setTypeId(typeId);
maMachine.setMaStatus("14"); maMachine.setMaStatus("14");
maMachine.setQrCode(qrCode); maMachine.setQrCode(purchaseMacodeInfo.getQrCode());
// 设备原厂编号 // 设备原厂编号
String fixCode = purchaseMacodeInfo.getFixCode(); String fixCode = purchaseMacodeInfo.getFixCode();
if ("0".equals(fixCode)) { if ("0".equals(fixCode)) {
@ -123,7 +118,16 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
maMachine.setCreateBy(SecurityUtils.getUsername()); maMachine.setCreateBy(SecurityUtils.getUsername());
purchaseMacodeInfoMapper.maMachineAdd(maMachine); 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.setStatus("0");
purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate()); purchaseMacodeInfo.setCreateTime(DateUtils.getNowDate());
purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo); purchaseMacodeInfoMapper.insertPurchaseMacodeInfo(purchaseMacodeInfo);
@ -211,27 +215,55 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
/** /**
* 生成设备编号 * 生成设备编号
* *
* @param maMachineLabel 类型id,生成数量 * @param equipmentNumberVO 类型id,生成数量
* @return 编码结果 * @return 编码结果
*/ */
@Override @Override
public String generateEquipmentNumber(MaMachineLabel maMachineLabel) { public JSONObject generateEquipmentNumber(EquipmentNumberVO equipmentNumberVO) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); Long typeId = equipmentNumberVO.getTypeId();
SimpleDateFormat sdf = new SimpleDateFormat("yyMM");
Date nowDate = DateUtils.getNowDate(); Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate); String format = sdf.format(nowDate);
int lableNum = purchaseMacodeInfoMapper.selectLableNumByMonth(nowDate) + 1;
String code=""; JSONObject jsonObject = purchaseMacodeInfoMapper.getTypeByTypeId(typeId);
if (lableNum>9 && lableNum<100){ String typeCode = jsonObject.getString("modelCode");
code = format + "-00" + lableNum; String specsCode = jsonObject.getString("specsCode");
}else if (lableNum>99 && lableNum<1000){ //序列号
code = format + "-0" + lableNum; int count = purchaseMacodeInfoMapper.getSerialNumber(typeId, nowDate) + 1;
}else { List<String> list = new ArrayList<>();
code = format + "-000" + lableNum; 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);
} }
maMachineLabel.setIsBind("0");
maMachineLabel.setLabelCode(code); JSONObject result = new JSONObject();
purchaseMacodeInfoMapper.insertMaMachineLabel(maMachineLabel); result.put("equipmentNum", list);
return code; result.put("twoDimensionalCode", codeList);
return result;
} }
/** /**
@ -246,7 +278,7 @@ public class PurchaseMacodeInfoServiceImpl implements IPurchaseMacodeInfoService
} }
/** /**
* 修改编码管理的入库状态,暂时不用 * 修改编码管理的入库状态
* *
* @param maInputVO 入库信息 * @param maInputVO 入库信息
* @return 结果 * @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 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 (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 left join sys_user su on pci.purchaser = su.user_id
where task_type = 23 where task_type = 23 and tk.task_status in (24,25,26,27)
<if test="purchaseTime != null and purchaseTime != ''"> and tk.code = #{code}</if> <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="purchaseTime != null and purchaseTime != ''"> and pci.purchase_time = #{purchaseTime}</if>
<if test="arrivalTime != null and arrivalTime != ''"> and pci.arrival_time = #{arrivalTime}</if> <if test="arrivalTime != null and arrivalTime != ''"> and pci.arrival_time = #{arrivalTime}</if>

View File

@ -235,25 +235,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="companyId != null">#{companyId},</if> <if test="companyId != null">#{companyId},</if>
</trim> </trim>
</insert> </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 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, select type_id typeId, type_name, parent_id, status, num, unit_id, manage_type, lease_price, buy_price, pay_price,
@ -279,7 +260,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPutinDetails" resultType="com.bonus.sgzb.material.domain.PurchaseMacodeInfo"> <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, 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, 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,mm.qr_code qrCode, if(pmi.ma_code is null, if(pcd.status != 4, 0 , 1), pmi.status) status,
if(pmi.ma_code is not null,1,pcd.check_num) checkNum if(pmi.ma_code is not null,1,pcd.check_num) checkNum
from purchase_check_details pcd 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 left join purchase_macode_info pmi on pmi.task_id = pcd.task_id and pmi.type_id = pcd.type_id
@ -287,16 +268,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ma_type mt on pcd.type_id = mt.type_id left join ma_type mt on pcd.type_id = mt.type_id
left join ma_type mt1 on mt.parent_id = mt1.type_id left join ma_type mt1 on mt.parent_id = mt1.type_id
where pcd.task_id = #{taskId} where pcd.task_id = #{taskId}
order by status
</select> </select>
<select id="selectMaCode" resultType="java.lang.Integer"> <select id="selectMaCode" resultType="java.lang.Integer">
select count(ma_id) from ma_machine where ma_code = #{maCode} select count(ma_id) from ma_machine where ma_code = #{maCode}
</select> </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 id="updateTypeByTypeId">
update ma_type set num = #{num} where type_id = #{typeId} update ma_type set num = #{num} where type_id = #{typeId}