流转卡扫描接口
This commit is contained in:
parent
bc49d5aedd
commit
abaf380f3f
@ -10,6 +10,7 @@ import com.ktg.mes.pro.domain.ProCard;
|
||||
import com.ktg.mes.pro.domain.ProWorkorder;
|
||||
import com.ktg.mes.pro.service.IProCardService;
|
||||
import com.ktg.mes.pro.service.IProWorkorderService;
|
||||
import com.ktg.mes.wm.utils.WmBarCodeUtil;
|
||||
import com.ktg.system.strategy.AutoCodeUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -39,6 +40,9 @@ public class ProCardMobController extends BaseController {
|
||||
@Autowired
|
||||
private AutoCodeUtil autoCodeUtil;
|
||||
|
||||
@Autowired
|
||||
private WmBarCodeUtil wmBarCodeUtil;
|
||||
|
||||
/**
|
||||
* 查询工序流转卡列表
|
||||
*/
|
||||
@ -122,6 +126,7 @@ public class ProCardMobController extends BaseController {
|
||||
proCard.setBatchCode(workorder.getBatchCode());
|
||||
proCard.setStatus(UserConstants.ORDER_STATUS_CONFIRMED);
|
||||
proCardService.insertProCard(proCard);
|
||||
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_PROCARD,proCard.getCardId(),proCard.getCardCode(),"");
|
||||
return AjaxResult.success(proCard);
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,21 @@
|
||||
package com.ktg.mes.pro.controller.mobile;
|
||||
|
||||
import com.ktg.common.annotation.Log;
|
||||
import com.ktg.common.constant.UserConstants;
|
||||
import com.ktg.common.core.controller.BaseController;
|
||||
import com.ktg.common.core.domain.AjaxResult;
|
||||
import com.ktg.common.core.page.TableDataInfo;
|
||||
import com.ktg.common.enums.BusinessType;
|
||||
import com.ktg.common.utils.StringUtils;
|
||||
import com.ktg.mes.md.domain.MdWorkstation;
|
||||
import com.ktg.mes.md.service.IMdWorkstationService;
|
||||
import com.ktg.mes.pro.domain.ProCard;
|
||||
import com.ktg.mes.pro.domain.ProCardProcess;
|
||||
import com.ktg.mes.pro.domain.ProTask;
|
||||
import com.ktg.mes.pro.domain.ProWorkorder;
|
||||
import com.ktg.mes.pro.service.IProCardProcessService;
|
||||
import com.ktg.mes.pro.service.IProCardService;
|
||||
import com.ktg.mes.pro.service.IProTaskService;
|
||||
import com.ktg.mes.pro.service.IProWorkorderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -41,6 +45,12 @@ public class ProCardProcessMobController extends BaseController {
|
||||
@Autowired
|
||||
private IMdWorkstationService mdWorkstationService;
|
||||
|
||||
@Autowired
|
||||
private IProWorkorderService proWorkorderService;
|
||||
|
||||
@Autowired
|
||||
private IProTaskService proTaskService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询工序流转卡-工序信息列表
|
||||
@ -54,7 +64,7 @@ public class ProCardProcessMobController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增工序流转卡-工序信息
|
||||
* 新增流转卡在某个工作站流转记录
|
||||
*/
|
||||
@ApiOperation("新增流转卡在某个工作站流转记录接口")
|
||||
@PreAuthorize("@ss.hasPermi('mes:pro:procard:add')")
|
||||
@ -99,6 +109,28 @@ public class ProCardProcessMobController extends BaseController {
|
||||
return AjaxResult.error("工作站无效!");
|
||||
}
|
||||
|
||||
/** 流转卡在某个工作站流转时的校验
|
||||
* 1.对应的生产工单没有结束
|
||||
* 2.为当前工作站分配了对应的生产任务
|
||||
**/
|
||||
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(card.getWorkorderId());
|
||||
if(StringUtils.isNotNull(workorder)){
|
||||
|
||||
if(UserConstants.ORDER_STATUS_FINISHED.equals(workorder.getStatus())){
|
||||
return AjaxResult.error("此流转卡对应的生产工单已经完成,无法再进行流转!");
|
||||
}
|
||||
|
||||
ProTask param = new ProTask();
|
||||
param.setWorkorderId(workorder.getWorkorderId());
|
||||
param.setWorkstationId(workstation.getWorkstationId());
|
||||
List<ProTask> tasks = proTaskService.selectProTaskList(param);
|
||||
if(CollectionUtils.isEmpty(tasks)){
|
||||
return AjaxResult.error("此工作站未被分配当前流转卡对应的生产任务!");
|
||||
}
|
||||
}else{
|
||||
return AjaxResult.error("流转卡对应的生产工单无效!");
|
||||
}
|
||||
|
||||
proCardProcess.setInputTime(new Date());
|
||||
proCardProcess.setUserId(getUserId());
|
||||
proCardProcess.setUserName(getUsername());
|
||||
@ -108,4 +140,54 @@ public class ProCardProcessMobController extends BaseController {
|
||||
|
||||
return AjaxResult.success(proCardProcess);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据扫描到的流转卡编号查询此工作站分配的生产任务
|
||||
* @param cardProcess
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("根据流转卡号查询所有的生产任务")
|
||||
@PreAuthorize("@ss.hasPermi('mes:pro:procard:list')")
|
||||
@GetMapping("/getCardProTask")
|
||||
public AjaxResult getCardProTask(ProCardProcess cardProcess){
|
||||
|
||||
ProCard p1 = new ProCard();
|
||||
p1.setCardCode(cardProcess.getCardCode());
|
||||
List<ProCard> cardList = proCardService.selectProCardList(p1);
|
||||
ProCard card = null;
|
||||
if(!CollectionUtils.isEmpty(cardList)){
|
||||
card = cardList.get(0);
|
||||
}else{
|
||||
return AjaxResult.error("流转卡无效!");
|
||||
}
|
||||
|
||||
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(card.getWorkorderId());
|
||||
if(StringUtils.isNotNull(workorder)){
|
||||
ProTask p = new ProTask();
|
||||
p.setWorkorderId(workorder.getWorkorderId());
|
||||
p.setWorkstationId(cardProcess.getWorkstationId());
|
||||
List<ProTask> tasks = proTaskService.selectProTaskList(p);
|
||||
if(CollectionUtils.isEmpty(tasks)){
|
||||
return AjaxResult.error("此工作站未被分配当前流转卡对应的生产任务!");
|
||||
}
|
||||
|
||||
return AjaxResult.success(tasks);
|
||||
}else{
|
||||
return AjaxResult.error("流转卡对应的生产工单无效!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除工序流转卡在某个工作站的流转记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('mes:pro:procard:remove')")
|
||||
@Log(title = "工序流转卡-工序信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{recordIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] recordIds)
|
||||
{
|
||||
return toAjax(proCardProcessService.deleteProCardProcessByRecordIds(recordIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="attr3 != null "> and attr3 = #{attr3}</if>
|
||||
<if test="attr4 != null "> and attr4 = #{attr4}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectProCardByCardId" parameterType="Long" resultMap="ProCardResult">
|
||||
|
Loading…
Reference in New Issue
Block a user