change - 切换订单

master
yinq 7 months ago
parent e971f3e10d
commit dd1dca83ec

@ -178,6 +178,9 @@ public class PdaApiController {
@PostMapping("/submitRepair")
public AjaxResult submitRepair(@RequestBody RepairSubmitInfoDto info) {
int i = service.submitRepair(info);
if (i == 999){
return error("该箱体未审批完成,无法降级!");
}
if(i > 0){
return success("操作成功!");
}else {
@ -230,4 +233,35 @@ public class PdaApiController {
}
return success(result);
}
/**
* PDA
* @param userName
* @return
*/
@PostMapping("/messageNotifications")
public AjaxResult messageNotifications(String userName) {
String result = service.messageNotifications(userName);
if (StringUtils.isEmpty(result)){
return error("无消息提醒!");
}
return success(result);
}
/**
* PDA
* @param barCode
* @param stationCode
* @return
*/
@PostMapping("/switchOrders")
public AjaxResult switchOrders(String barCode,String stationCode) {
String result = service.switchOrders(barCode, stationCode);
if (StringUtils.isEmpty(result)){
return error("条码信息输入错误!");
}
return success(result);
}
}

@ -61,4 +61,15 @@ public interface PdaBindingMapper {
* @return
*/
List<ReportQualityInspection> findCheckInfoByCodeUserId(String code);
List<HashMap<String, String>> downgradedProductCardControl(@Param("objId") String objId);
/**
* PDA
* @param userName
* @return
*/
List<HashMap<String, String>> messageNotifications(@Param("userName") String userName);
}

@ -5,7 +5,11 @@ import com.aucma.api.mapper.PdaBindingMapper;
import com.aucma.api.service.IPdaBindingService;
import com.aucma.common.utils.SecurityUtils;
import com.aucma.common.utils.StringUtils;
import com.aucma.report.domain.RecordExceptionProcess;
import com.aucma.report.domain.RecordSwitchOrder;
import com.aucma.report.domain.ReportQualityInspection;
import com.aucma.report.service.IRecordExceptionProcessService;
import com.aucma.report.service.IRecordSwitchOrderService;
import com.aucma.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -25,6 +29,12 @@ public class PdaServiceImpl implements IPdaBindingService {
@Autowired
private ISysPostService postService;
@Autowired
private IRecordExceptionProcessService recordExceptionProcessService;
@Autowired
private IRecordSwitchOrderService recordSwitchOrderService;
@Override
public String selectBoxNameByCode(String boxCode) {
@ -53,6 +63,13 @@ public class PdaServiceImpl implements IPdaBindingService {
*/
@Override
public int submitRepair(RepairSubmitInfoDto info) {
if(StringUtils.isNotEmpty(info.getRepairName()) && info.getRepairName().equals("KA")){
//降级品卡控
List<HashMap<String, String>> hashMaps = mapper.downgradedProductCardControl(String.valueOf(info.getList().get(0)));
if (hashMaps.size() == 0){
return 999;
}
}
return mapper.submitRepair(info);
}
@ -119,4 +136,54 @@ public class PdaServiceImpl implements IPdaBindingService {
return result;
}
/**
* PDA
* @param userName
* @return
*/
@Override
public String messageNotifications(String userName) {
List<HashMap<String, String>> barcodeList = mapper.messageNotifications(userName);
String resultMessage = null;
StringBuilder boxCode = null;
for (HashMap<String, String> map : barcodeList) {
String userNames = map.get("INSPECTION_USER_CODE");
if (userNames.equals("NULL")){
userNames = userName;
} else {
if (userNames.contains(userName)){
continue;
}
userNames = userNames + "," + userName;
}
RecordExceptionProcess recordExceptionProcess = new RecordExceptionProcess();
recordExceptionProcess.setObjId(Long.valueOf(String.valueOf(map.get("OBJ_ID"))));
recordExceptionProcess.setInspectionUserCode(userNames);
recordExceptionProcessService.updateRecordExceptionProcess(recordExceptionProcess);
if (boxCode == null){
boxCode = new StringBuilder(map.get("BOX_BARCODE"));
} else {
boxCode.append(",").append(map.get("BOX_BARCODE"));
}
resultMessage = "箱体码:" + boxCode + "已审批完成请进行PDA降级处理";
}
return resultMessage;
}
/**
* PDA
* @param barCode
* @param stationCode
* @return
*/
@Override
public String switchOrders(String barCode, String stationCode) {
RecordSwitchOrder recordSwitchOrder = new RecordSwitchOrder();
recordSwitchOrder.setMaterialBarcode(barCode);
recordSwitchOrder.setSwitchStationCode(stationCode);
recordSwitchOrderService.insertRecordSwitchOrder(recordSwitchOrder);
return "提交成功!";
}
}

@ -89,12 +89,29 @@
where BAR_CODE = #{code}
AND TREATMENT_MEASURE = '1'
</select>
<select id="downgradedProductCardControl" resultType="java.util.HashMap">
SELECT REP.BOX_BARCODE, REP.PRODUCTION_USER_FLAG
FROM REPORT_QUALITY_INSPECTION RQI
LEFT JOIN RECORD_EXCEPTION_PROCESS REP ON REP.BOX_BARCODE = RQI.BAR_CODE
WHERE REP.PRODUCTION_USER_FLAG = '9' AND RQI.OBJ_ID = #{objId}
</select>
<select id="messageNotifications" resultType="java.util.HashMap">
SELECT OBJ_ID, BOX_BARCODE, NVL(INSPECTION_USER_CODE, 'NULL') INSPECTION_USER_CODE
FROM RECORD_EXCEPTION_PROCESS
WHERE PRODUCTION_USER_FLAG = '9'
AND QUALITY_MANAGER_TIME > (SYSDATE - 7.25)
AND (INSPECTION_USER_CODE IS NULL OR INSPECTION_USER_CODE NOT LIKE '%' || #{userName} || '%')
</select>
<update id="unbindBarCode">
UPDATE CODE_BINDING
SET PRODUCT_CODE = NULL, RECORD_TIME2 = NULL
WHERE BOX_CODE = #{boxCode}
</update>
<update id="updateExceptionProcess">
</update>
<insert id="printSupplementBarcode">
INSERT INTO PRINT_SUPPLEMENTBARCODE

@ -51,9 +51,9 @@ public class RecordExceptionProcess extends BaseEntity {
private String materialModel;
/**
* 1=2=3=4=,9=
* 1=2=3=4=,9=
*/
@Excel(name = "流转标识", readConverterExp = "1=正常流转,2=质管员拒绝,3=生产经理拒绝,4=质量经理拒绝,9=流转完成")
@Excel(name = "流转标识", readConverterExp = "1=正常流转,2=质管员拒绝,3=生产经理拒绝,4=质量经理拒绝,9=流转完成")
private String productionUserFlag;
/**
@ -101,39 +101,39 @@ public class RecordExceptionProcess extends BaseEntity {
private Date qualityUserTime;
/**
*
*
*/
@Excel(name = "生产经理标识", readConverterExp = "1=同意,2=拒绝")
@Excel(name = "生产经理标识", readConverterExp = "1=同意,2=拒绝")
private String productionManagerFlag;
/**
*
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "生产经理审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "生产经理审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date productionManagerTime;
/**
*
*
*/
@Excel(name = "质量经理标识", readConverterExp = "1=同意,2=拒绝")
@Excel(name = "质量经理标识", readConverterExp = "1=同意,2=拒绝")
private String qualityManagerFlag;
/**
*
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "质量经理审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "质量经理审核时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date qualityManagerTime;
/**
*
* List
*/
@Excel(name = "巡检班长编号")
private String inspectionUserCode;
/**
*
* (1=)
*/
@Excel(name = "巡检班长消息标识")
private String inspectionUserFlag;

@ -32,6 +32,12 @@ public class RecordSwitchOrder extends BaseEntity {
@Excel(name = "切换工位编号")
private String switchStationCode;
/**
*
*/
@Excel(name = "切换工位名称")
private String switchStationName;
/**
*
*/
@ -56,6 +62,15 @@ public class RecordSwitchOrder extends BaseEntity {
@Excel(name = "打印标识")
private String isPrint;
public String getSwitchStationName() {
return switchStationName;
}
public void setSwitchStationName(String switchStationName) {
this.switchStationName = switchStationName;
}
public void setObjId(Long objId) {
this.objId = objId;
}

@ -1,5 +1,6 @@
package com.aucma.report.mapper;
import java.util.HashMap;
import java.util.List;
import com.aucma.report.domain.RecordSwitchOrder;
@ -58,4 +59,16 @@ public interface RecordSwitchOrderMapper
* @return
*/
public int deleteRecordSwitchOrderByObjIds(Long[] objIds);
/**
*
* @param code
* @return
*/
List<HashMap<String, String>> selectPrintBarcode(String code);
int printSupplementBarcode(HashMap<String, String> hashMap);
int updatePrintCode(RecordSwitchOrder recordSwitchOrder);
}

@ -1,13 +1,21 @@
package com.aucma.report.service.impl;
import java.util.HashMap;
import java.util.List;
import com.aucma.base.domain.BaseOrderInfo;
import com.aucma.base.service.IBaseOrderInfoService;
import com.aucma.common.exception.ServiceException;
import com.aucma.common.utils.DateUtils;
import com.aucma.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.report.mapper.RecordSwitchOrderMapper;
import com.aucma.report.domain.RecordSwitchOrder;
import com.aucma.report.service.IRecordSwitchOrderService;
import static com.aucma.common.utils.SecurityUtils.getUsername;
/**
* Service
*
@ -15,11 +23,13 @@ import com.aucma.report.service.IRecordSwitchOrderService;
* @date 2024-04-23
*/
@Service
public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
{
public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService {
@Autowired
private RecordSwitchOrderMapper recordSwitchOrderMapper;
@Autowired
private IBaseOrderInfoService baseOrderInfoService;
/**
*
*
@ -27,8 +37,7 @@ public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
* @return
*/
@Override
public RecordSwitchOrder selectRecordSwitchOrderByObjId(Long objId)
{
public RecordSwitchOrder selectRecordSwitchOrderByObjId(Long objId) {
return recordSwitchOrderMapper.selectRecordSwitchOrderByObjId(objId);
}
@ -39,8 +48,7 @@ public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
* @return
*/
@Override
public List<RecordSwitchOrder> selectRecordSwitchOrderList(RecordSwitchOrder recordSwitchOrder)
{
public List<RecordSwitchOrder> selectRecordSwitchOrderList(RecordSwitchOrder recordSwitchOrder) {
return recordSwitchOrderMapper.selectRecordSwitchOrderList(recordSwitchOrder);
}
@ -51,8 +59,12 @@ public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
* @return
*/
@Override
public int insertRecordSwitchOrder(RecordSwitchOrder recordSwitchOrder)
{
public int insertRecordSwitchOrder(RecordSwitchOrder recordSwitchOrder) {
try {
recordSwitchOrder.setCreateBy(getUsername());
} catch (Exception e) {
e.printStackTrace();
}
recordSwitchOrder.setCreateTime(DateUtils.getNowDate());
return recordSwitchOrderMapper.insertRecordSwitchOrder(recordSwitchOrder);
}
@ -64,10 +76,31 @@ public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
* @return
*/
@Override
public int updateRecordSwitchOrder(RecordSwitchOrder recordSwitchOrder)
{
public int updateRecordSwitchOrder(RecordSwitchOrder recordSwitchOrder) {
String oldOrderCode = recordSwitchOrder.getOrderCode();
String newOrderCode = recordSwitchOrder.getOldOrderCode();
BaseOrderInfo baseOrderInfo = new BaseOrderInfo();
baseOrderInfo.setOrderCode(newOrderCode);
List<BaseOrderInfo> baseOrderInfos = baseOrderInfoService.selectBaseOrderInfoList(baseOrderInfo);
if (baseOrderInfos.size() == 0){
throw new ServiceException("MES系统未维护此SAP订单");
}
recordSwitchOrder.setIsSwitch("1");
recordSwitchOrder.setOldOrderCode(oldOrderCode);
recordSwitchOrder.setOrderCode(newOrderCode);
recordSwitchOrder.setUpdateBy(getUsername());
recordSwitchOrder.setUpdateTime(DateUtils.getNowDate());
return recordSwitchOrderMapper.updateRecordSwitchOrder(recordSwitchOrder);
try {
recordSwitchOrderMapper.updatePrintCode(recordSwitchOrder);
recordSwitchOrderMapper.updateRecordSwitchOrder(recordSwitchOrder);
List<HashMap<String, String>> barcodeList = recordSwitchOrderMapper.selectPrintBarcode(recordSwitchOrder.getMaterialBarcode());
// 维护条码补打记录表
recordSwitchOrderMapper.printSupplementBarcode(barcodeList.get(0));
} catch (Exception e) {
e.printStackTrace();
}
return 1;
}
/**
@ -77,8 +110,7 @@ public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
* @return
*/
@Override
public int deleteRecordSwitchOrderByObjIds(Long[] objIds)
{
public int deleteRecordSwitchOrderByObjIds(Long[] objIds) {
return recordSwitchOrderMapper.deleteRecordSwitchOrderByObjIds(objIds);
}
@ -89,8 +121,7 @@ public class RecordSwitchOrderServiceImpl implements IRecordSwitchOrderService
* @return
*/
@Override
public int deleteRecordSwitchOrderByObjId(Long objId)
{
public int deleteRecordSwitchOrderByObjId(Long objId) {
return recordSwitchOrderMapper.deleteRecordSwitchOrderByObjId(objId);
}
}

@ -8,6 +8,7 @@
<result property="objId" column="obj_id"/>
<result property="materialBarcode" column="material_barcode"/>
<result property="switchStationCode" column="switch_station_code"/>
<result property="switchStationName" column="switch_station_name"/>
<result property="oldOrderCode" column="old_order_code"/>
<result property="isSwitch" column="is_switch"/>
<result property="createBy" column="create_by"/>
@ -20,49 +21,54 @@
</resultMap>
<sql id="selectRecordSwitchOrderVo">
select obj_id,
material_barcode,
switch_station_code,
old_order_code,
is_switch,
create_by,
create_time,
update_by,
update_time,
remark,
order_code,
is_print
from record_switch_order
SELECT rso.obj_id,
rso.material_barcode,
rso.switch_station_code,
pl.PRODUCT_LINE_NAME switch_station_name,
rso.old_order_code,
rso.is_switch,
rso.create_by,
rso.create_time,
rso.update_by,
rso.update_time,
rso.remark,
PB.ORDER_CODE,
ps.IS_PRINT is_print
FROM record_switch_order rso
left join BASE_PRODUCTLINE pl ON rso.switch_station_code = pl.PRODUCT_LINE_CODE
left join C##AUCMA_SCADA.PRINT_BARCODE PB ON PB.MATERIAL_BARCODE = rso.MATERIAL_BARCODE
left join C##AUCMA_SCADA.PRINT_SUPPLEMENTBARCODE ps ON ps.MATERIAL_BARCODE = rso.MATERIAL_BARCODE
</sql>
<select id="selectRecordSwitchOrderList" parameterType="RecordSwitchOrder" resultMap="RecordSwitchOrderResult">
<include refid="selectRecordSwitchOrderVo"/>
<where>
<if test="objId != null ">and obj_id = #{objId}</if>
<if test="materialBarcode != null and materialBarcode != ''">and material_barcode = #{materialBarcode}</if>
<if test="switchStationCode != null and switchStationCode != ''">and switch_station_code =
<if test="objId != null ">and rso.obj_id = #{objId}</if>
<if test="materialBarcode != null and materialBarcode != ''">and rso.material_barcode = #{materialBarcode}</if>
<if test="switchStationCode != null and switchStationCode != ''">and rso.switch_station_code =
#{switchStationCode}
</if>
<if test="oldOrderCode != null and oldOrderCode != ''">and old_order_code = #{oldOrderCode}</if>
<if test="isSwitch != null and isSwitch != ''">and is_switch = #{isSwitch}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="oldOrderCode != null and oldOrderCode != ''">and rso.old_order_code = #{oldOrderCode}</if>
<if test="isSwitch != null and isSwitch != ''">and rso.is_switch = #{isSwitch}</if>
<if test="createBy != null and createBy != ''">and rso.create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''">
and create_time between to_date(#{params.beginCreateTime}, 'yyyy-mm-dd hh24:mi:ss') and
and rso.create_time between to_date(#{params.beginCreateTime}, 'yyyy-mm-dd hh24:mi:ss') and
to_date(#{params.endCreateTime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy}</if>
<if test="updateBy != null and updateBy != ''">and rso.update_by = #{updateBy}</if>
<if test="params.beginUpdateTime != null and params.beginUpdateTime != '' and params.endUpdateTime != null and params.endUpdateTime != ''">
and update_time between to_date(#{params.beginUpdateTime}, 'yyyy-mm-dd hh24:mi:ss') and
and rso.update_time between to_date(#{params.beginUpdateTime}, 'yyyy-mm-dd hh24:mi:ss') and
to_date(#{params.endUpdateTime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test="orderCode != null and orderCode != ''">and order_code = #{orderCode}</if>
<if test="isPrint != null and isPrint != ''">and is_print = #{isPrint}</if>
<if test="orderCode != null and orderCode != ''">and PB.order_code = #{orderCode}</if>
<if test="isPrint != null and isPrint != ''">and rso.is_print = #{isPrint}</if>
</where>
order by rso.create_time desc
</select>
<select id="selectRecordSwitchOrderByObjId" parameterType="Long" resultMap="RecordSwitchOrderResult">
<include refid="selectRecordSwitchOrderVo"/>
where obj_id = #{objId}
where rso.obj_id = #{objId}
</select>
<insert id="insertRecordSwitchOrder" parameterType="RecordSwitchOrder">
@ -115,6 +121,12 @@
where obj_id = #{objId}
</update>
<update id="updatePrintCode" parameterType="RecordSwitchOrder">
update C##AUCMA_SCADA.PRINT_BARCODE
set ORDER_CODE = #{orderCode}
where MATERIAL_BARCODE = #{materialBarcode}
</update>
<delete id="deleteRecordSwitchOrderByObjId" parameterType="Long">
delete
from record_switch_order
@ -127,4 +139,40 @@
#{objId}
</foreach>
</delete>
<select id="selectPrintBarcode" resultType="java.util.HashMap">
SELECT PB.ORDER_CODE,
PB.MATERIAL_CODE,
PB.MATERIAL_NAME,
PB.MATERIAL_BARCODE,
PB.PRINT_BARTYPE,
OI.PRINT_NAME,
NVL(MIN(PS.IS_PRINT), 1) IS_PRINT
FROM BASE_ORDERINFO OI
JOIN C##AUCMA_SCADA.PRINT_BARCODE PB ON PB.ORDER_CODE = OI.ORDER_CODE
LEFT JOIN C##AUCMA_SCADA.PRINT_SUPPLEMENTBARCODE PS ON PS.MATERIAL_BARCODE = PB.MATERIAL_BARCODE
WHERE PB.MATERIAL_BARCODE = #{boxCode}
GROUP BY PB.ORDER_CODE, PB.MATERIAL_CODE, PB.MATERIAL_NAME, PB.MATERIAL_BARCODE, PB.PRINT_BARTYPE,
OI.PRINT_NAME
</select>
<insert id="printSupplementBarcode">
INSERT INTO C##AUCMA_SCADA.PRINT_SUPPLEMENTBARCODE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ORDER_CODE != null">ORDER_CODE,</if>
<if test="MATERIAL_CODE != null">MATERIAL_CODE,</if>
<if test="MATERIAL_NAME != null">MATERIAL_NAME,</if>
<if test="MATERIAL_BARCODE != null">MATERIAL_BARCODE,</if>
<if test="PRINT_BARTYPE != null">PRINT_BARTYPE,</if>
<if test="PRINT_NAME != null">PRINT_NAME,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ORDER_CODE != null">#{ORDER_CODE},</if>
<if test="MATERIAL_CODE != null">#{MATERIAL_CODE},</if>
<if test="MATERIAL_NAME != null">#{MATERIAL_NAME},</if>
<if test="MATERIAL_BARCODE != null">#{MATERIAL_BARCODE},</if>
<if test="PRINT_BARTYPE != null">#{PRINT_BARTYPE},</if>
<if test="PRINT_NAME != null">#{PRINT_NAME},</if>
</trim>
</insert>
</mapper>
Loading…
Cancel
Save