Leon 4 years ago
commit db6e6fd85d

@ -6,20 +6,11 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto;
import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.model.DataField;
import com.foreverwin.mesnac.meapi.model.NcCode;
import com.foreverwin.mesnac.meapi.model.WorkCenter;
import com.foreverwin.mesnac.meapi.service.DataFieldListService;
import com.foreverwin.mesnac.meapi.service.NcCodeService;
import com.foreverwin.mesnac.meapi.service.WorkCenterService;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
import com.foreverwin.modular.core.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
/**
@ -34,14 +25,6 @@ public class AbnormalBillController {
@Autowired
private AbnormalBillService abnormalBillService;
@Autowired
private NcCodeService ncCodeService;
@Autowired
private WorkCenterService workCenterService;
@Autowired
private DataFieldListService dataFieldListService;
/**
* id
@ -170,37 +153,7 @@ public class AbnormalBillController {
*/
@GetMapping("/init")
public R init(String messageType){
HashMap<String, Object> hashMap = new HashMap<>();
String site = CommonMethods.getSite();
//消息类型
if(!StringUtil.isBlank(messageType)){
List<NcCode> ncByNG = ncCodeService.findNcByNG(messageType,null);
hashMap.put("ncByNG",ncByNG);
}
//工作中心
WorkCenter workCenter = new WorkCenter();
workCenter.setWcCategory("LEVEL4");
workCenter.setSite(site);
List<WorkCenter> workCenterList = workCenterService.selectList(workCenter);
hashMap.put("workCenter",workCenterList);
//原因分类
NcCode ncCode = new NcCode();
ncCode.setSite(site);
ncCode.setNcCategory("REPAIR");
List<NcCode> ncCodeList = ncCodeService.selectList(ncCode);
hashMap.put("causeType",ncCodeList);
//责任部门
DataField dataField = new DataField();
dataField.setSite(site);
dataField.setDataField("RESPONSIBILITY_DEPARTMENT");
List<DataField> dutyDepartList = dataFieldListService.findDataFieldListById(dataField);
hashMap.put("dutyDepart",dutyDepartList);
//责任分类
dataField.setDataField("RESPONSIBILITY_TYPE");
List<DataField> dutyTypeList = dataFieldListService.findDataFieldListById(dataField);
hashMap.put("dutyType",dutyTypeList);
return R.ok(hashMap);
return R.ok(abnormalBillService.init(messageType));
}
// @GetMapping("/findAllUserByUserGroup")
@ -269,21 +222,50 @@ public class AbnormalBillController {
return R.ok(abnormalBillService.findAllByAbnormalNo(abnormalBill));
}
/**
*
* @param abnormalBill
* @return
*/
@GetMapping("/resProcessing")
public R resProcessing(AbnormalBill abnormalBill){
abnormalBillService.resProcessing(abnormalBill);
return R.ok();
}
@GetMapping("programConfirm")
/**
*
* @param abnormalBill
* @param abnormalBillDispose
* @return
*/
@GetMapping("/programConfirm")
public R programConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
abnormalBillService.programConfirm(abnormalBill,abnormalBillDispose);
return R.ok();
}
@GetMapping("dutyConfirm")
/**
*
* @param abnormalBill
* @param abnormalBillDispose
* @return
*/
@GetMapping("/dutyConfirm")
public R dutyConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
abnormalBillService.dutyConfirm(abnormalBill,abnormalBillDispose);
return R.ok();
}
/**
*
* @param abnormalBill
* @param abnormalBillDispose
* @return
*/
@GetMapping("/anomalyShutDown")
public R anomalyShutDown(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose){
abnormalBillService.anomalyShutDown(abnormalBill,abnormalBillDispose);
return R.ok();
}
}

@ -8,6 +8,7 @@ import com.foreverwin.mesnac.anomaly.model.AbnormalBill;
import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose;
import com.foreverwin.modular.core.util.FrontPage;
import java.util.HashMap;
import java.util.List;
/**
@ -51,6 +52,10 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose);
/**
*
*/
HashMap<String,Object> init(String messageType);
/**
*
* @param abnormalBillDto
@ -81,4 +86,11 @@ public interface AbnormalBillService extends IService<AbnormalBill> {
*/
void dutyConfirm(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose);
/**
*
* @param abnormalBill
* @param abnormalBillDispose
*/
void anomalyShutDown(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose);
}

@ -9,13 +9,13 @@ import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillDisposeMapper;
import com.foreverwin.mesnac.anomaly.mapper.AbnormalBillMapper;
import com.foreverwin.mesnac.anomaly.model.*;
import com.foreverwin.mesnac.anomaly.service.*;
import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.helper.NextNumberHelper;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.meapi.mapper.*;
import com.foreverwin.mesnac.meapi.model.*;
import com.foreverwin.mesnac.meapi.service.NcCodeService;
import com.foreverwin.mesnac.meapi.service.NwaUserService;
import com.foreverwin.mesnac.meapi.service.*;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import com.foreverwin.modular.core.util.FrontPage;
@ -25,10 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.*;
/**
* <p>
@ -86,6 +83,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
@Autowired
private NwaUserMapper nwaUserMapper;
@Autowired
private RouterService routerService;
@Autowired
private WorkCenterService workCenterService;
@Autowired
private DataFieldListService dataFieldListService;
@Override
public IPage<AbnormalBill> selectPage(FrontPage<AbnormalBill> frontPage, AbnormalBill abnormalBill) {
QueryWrapper<AbnormalBill> queryWrapper = new QueryWrapper<>();
@ -179,6 +186,41 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
return abnormalBill.getAbnormalNo();
}
@Override
public HashMap<String, Object> init(String messageType) {
HashMap<String, Object> hashMap = new HashMap<>();
String site = CommonMethods.getSite();
//消息类型
if(!StringUtil.isBlank(messageType)){
List<NcCode> ncByNG = ncCodeService.findNcByNG(messageType,null);
hashMap.put("ncByNG",ncByNG);
}
//工作中心
WorkCenter workCenter = new WorkCenter();
workCenter.setWcCategory("LEVEL4");
workCenter.setSite(site);
List<WorkCenter> workCenterList = workCenterService.selectList(workCenter);
hashMap.put("workCenter",workCenterList);
//原因分类
NcCode ncCode = new NcCode();
ncCode.setSite(site);
ncCode.setNcCategory("REPAIR");
List<NcCode> ncCodeList = ncCodeService.selectList(ncCode);
hashMap.put("causeType",ncCodeList);
//责任部门
DataField dataField = new DataField();
dataField.setSite(site);
dataField.setDataField("RESPONSIBILITY_DEPARTMENT");
List<DataField> dutyDepartList = dataFieldListService.findDataFieldListById(dataField);
hashMap.put("dutyDepart",dutyDepartList);
//责任分类
dataField.setDataField("RESPONSIBILITY_TYPE");
List<DataField> dutyTypeList = dataFieldListService.findDataFieldListById(dataField);
hashMap.put("dutyType",dutyTypeList);
return hashMap;
}
@Override
public List<AbnormalBillDto> backLog(AbnormalBillDto abnormalBillDto) {
String language = LocaleContextHolder.getLocale().getLanguage();
@ -206,7 +248,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
abnormalBill.setSite(site);
abnormalBill.setResponseUser(user);
abnormalBill.setResponseDateTime(now);
abnormalBill.setStatus("X");
abnormalBill.setStatus(Constants.RESPONSE);
this.saveOrUpdate(abnormalBill);
}
@ -217,15 +259,26 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断该返修工艺是否正确
Router routerBo = routerMapper.selectById(abnormalBillDispose.getRouterBo());
if(routerBo == null){
throw BusinessException.build("该返修工艺不存在");
if(!StringUtil.isBlank(abnormalBillDispose.getRouterBo())){
//分割该工艺路线
String[] routerSplit = abnormalBillDispose.getRouterBo().split(",");
//判断该返修工艺是否正确
Router router = new Router();
router.setSite(site);
router.setRouter(routerSplit[1]);
router.setRouterType(routerSplit[2]);
router.setCurrentRevision("true");
List<Router> routers = routerService.selectList(router);
if(routers == null || routers.size() == 0){
throw BusinessException.build("该返修工艺不存在");
}
}
//判断返修工单是否正确
ShopOrder shopOrder = shopOrderMapper.selectById(HandleEnum.SHOP_ORDER.getHandle(site, abnormalBillDispose.getResolveShopOrder()));
if(shopOrder == null){
throw BusinessException.build("该返修工单不存在");
if(!StringUtil.isBlank(abnormalBillDispose.getResolveShopOrder())){
ShopOrder shopOrder = shopOrderMapper.selectById(HandleEnum.SHOP_ORDER.getHandle(site, abnormalBillDispose.getResolveShopOrder()));
if(shopOrder == null){
throw BusinessException.build("该返修工单不存在");
}
}
//发送用户
String[] split = abnormalBillDispose.getResolveSendUser().split(",");
@ -239,7 +292,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
//设置解决方案的处理时间和处理人
abnormalBillDispose.setResolveDateTime(now);
abnormalBillDispose.setResolveUser(user);
abnormalBill.setStatus("F");
abnormalBill.setStatus(Constants.PROGRAM_CONFIRM);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
this.saveOrUpdate(abnormalBill);
@ -251,6 +304,15 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断判责提交是否已经填写
AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
if(abnormalBillDispose1 != null){
if(!StringUtil.isBlank(abnormalBillDispose1.getDutyCauseType())){
throw BusinessException.build("该异常单已经判责提交");
}
}
abnormalBill.setStatus(Constants.CORRECTION_CONFIRM);
abnormalBillDispose.setDutyDateTime(now);
abnormalBillDispose.setDutyUser(user);
@ -260,6 +322,29 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
}
@Override
public void anomalyShutDown(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose) {
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
LocalDateTime now = LocalDateTime.now();
abnormalBillDispose.setHandle(HandleEnum.Z_ABNORMAL_BILL_DISPOSE.getHandle(site,abnormalBill.getAbnormalNo()));
//判断判责提交是否还没有进行填写
AbnormalBillDispose abnormalBillDispose1 = abnormalBillDisposeMapper.selectById(abnormalBillDispose.getHandle());
if(abnormalBillDispose1 != null){
if(StringUtil.isBlank(abnormalBillDispose1.getDutyCauseType())){
throw BusinessException.build("该异常单还没有进行判责提交");
}
}
abnormalBill.setStatus(Constants.SHUT_DOWN);
abnormalBillDispose.setClosedUser(user);
abnormalBillDispose.setClosedDateTime(now);
this.saveOrUpdate(abnormalBill);
abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
}
@Override
public void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List<String> dutyCauseType,List<String> dutyType) {
String site = CommonMethods.getSite();
@ -401,7 +486,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl<AbnormalBillMapper, Abn
public void cancelBrowse(String handle, String cancelBrowse) {
LocalDateTime now = LocalDateTime.now();
AbnormalBill abnormalBill = abnormalBillMapper.selectById(handle);
abnormalBill.setStatus("Q");
abnormalBill.setStatus(Constants.CANCEL);
abnormalBill.setCancelReason(cancelBrowse);
abnormalBill.setCancelUser(CommonMethods.getUser());
abnormalBill.setCancelDateTime(now);

@ -622,7 +622,7 @@
ZABD.DUTY_SEND_USER_GROUP DUTY_SEND_USER_GROUP,ZABD.DUTY_TYPE DUTY_TYPE,ZABD.PRINCIPAL_USER PRINCIPAL_USER,ZABD.ABNORMAL_METHOD ABNORMAL_METHOD,
R.ROUTER ROUTER,ZABD.RESOLVE_SHOP_ORDER RESOLVE_SHOP_ORDER,ZABD.RESOLVE_REMARK RESOLVE_REMARK,ZABD.RESOLVE_SEND_USER RESOLVE_SEND_USER,
ZABD.ABNORMAL_REASON ABNORMAL_REASON,ZABD.BEFORE_MEASURE BEFORE_MEASURE,"MAP".VALUE "MAP",
R.HANDLE ROUTER_BO
ZABD.ROUTER_BO ROUTER_BO
FROM Z_ABNORMAL_BILL ZAB
LEFT JOIN Z_ABNORMAL_BILL_DISPOSE ZABD ON ZAB.HANDLE = ZABD.ABNORMAL_BILL_BO
INNER JOIN ITEM I ON I.HANDLE = ZAB.ITEM_BO
@ -635,7 +635,7 @@
LEFT JOIN Z_ABNORMAL_NC_CODE ZANC ON ZAB.HANDLE = ZANC.ABNORMAL_BILL_BO
LEFT JOIN NC_CODE_T NCT ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE) = NCT.NC_CODE_BO AND NCT.LOCALE = #{language}
LEFT JOIN NC_CODE_T NCT2 ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE_GROUP) = NCT2.NC_CODE_BO AND NCT2.LOCALE = #{language}
LEFT JOIN ROUTER R ON R.HANDLE = ZABD.ROUTER_BO
LEFT JOIN ROUTER R ON SUBSTR(R.HANDLE,1,INSTR(R.HANDLE,',',-1)-1) = SUBSTR(ZABD.ROUTER_BO,1,INSTR(ZABD.ROUTER_BO,',',-1)-1) AND R.CURRENT_REVISION = 'true'
<where>
<if test="abnormalBill != null">
<if test="abnormalBill.site != null and abnormalBill.site != ''">
@ -656,6 +656,6 @@
ZAB.PB_PHOTOSHOP ,ZABD.DUTY_CAUSE_DESCRIPTION ,ZABD.DUTY_CAUSE_TYPE ,ZABD.DUTY_DEPART ,
ZABD.DUTY_SEND_USER_GROUP ,ZABD.DUTY_TYPE ,ZABD.PRINCIPAL_USER ,ZABD.ABNORMAL_METHOD ,
R.ROUTER ,ZABD.RESOLVE_SHOP_ORDER ,ZABD.RESOLVE_REMARK ,ZABD.RESOLVE_SEND_USER ,
ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,R.HANDLE
ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO
</select>
</mapper>

@ -17,6 +17,14 @@ public interface Constants {
String STATUS_Y = "Y";
String STATUS_N = "N";
//异常单状态
String NEW = "N";
String RESPONSE = "X";
String PROGRAM_CONFIRM = "F";
String CORRECTION_CONFIRM = "J";
String CANCEL = "Q";
String SHUT_DOWN = "G";
//任务编号常量
String RESOURCE_INSPECT_TASK = "RESOURCE_INSPECT_TASK";

@ -53,6 +53,7 @@ public class ItemController {
String site = CommonMethods.getSite();
item.setSite(site);
item.setCurrentRevision("true");
QueryWrapper<Item> queryWrapper = new QueryWrapper<>();
queryWrapper.setEntity(item);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {

@ -65,6 +65,8 @@ public class RouterController {
public R page(FrontPage<Router> frontPage, Router router){
IPage result;
QueryWrapper<Router> queryWrapper = new QueryWrapper<>();
String site = CommonMethods.getSite();
router.setSite(site);
queryWrapper.setEntity(router);
if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) {
//TODO modify global query

@ -75,8 +75,8 @@ public class ShopOrderController {
* @return
*/
@GetMapping("/findById")
public R findById(String handle){
return R.ok(shopOrderService.findById(handle));
public R findById(String handle,String plannedItemBo){
return R.ok(shopOrderService.findById(handle,plannedItemBo));
}
/**

@ -17,7 +17,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface ShopOrderMapper extends BaseMapper<ShopOrder> {
ShopOrder findById(@Param("handle")String handle,@Param("status501")String status501);
ShopOrder findById(@Param("handle")String handle,@Param("status501")String status501,@Param("plannedItemBo")String plannedItemBo);
ShopOrderDto findByShopOrderBo(@Param("handle")String handle);
}

@ -32,7 +32,7 @@ public interface ShopOrderService extends IService<ShopOrder> {
* @param handle
* @return
*/
ShopOrder findById(String handle);
ShopOrder findById(String handle,String plannedItemBo);
ShopOrderDto findByShopOrderBo(String handle);

@ -46,10 +46,10 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
}
@Override
public ShopOrder findById(String handle) {
public ShopOrder findById(String handle,String plannedItemBo) {
String site = CommonMethods.getSite();
String status501 = new StatusBOHandle(site,"501").getValue();
return shopOrderMapper.findById(handle,status501);
return shopOrderMapper.findById(handle,status501,plannedItemBo);
}
@Override

@ -231,12 +231,12 @@
<if test="ew.entity.origin!=null"> AND ORIGIN=#{ew.entity.origin}</if>
</if>
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
${ew.sqlSegment}
AND ${ew.sqlSegment}
</if>
</if>
</where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
${ew.sqlSegment}
AND ${ew.sqlSegment}
</if>
</select>

@ -1000,6 +1000,9 @@
<if test="handle != null and handle != ''">
AND HANDLE = #{handle}
</if>
<if test="plannedItemBo!= null and plannedItemBo != ''">
AND PLANNED_ITEM_BO = #{plannedItemBo}
</if>
</where>
</select>

Loading…
Cancel
Save