Merge remote-tracking branch 'origin/master'

# Conflicts:
#	op-common/op-common-core/src/main/java/com/op/common/core/constant/ServiceNameConstants.java
master
Yangwl 1 year ago
commit 308492d614

@ -4,7 +4,6 @@ import com.op.common.core.constant.ServiceNameConstants;
import com.op.common.core.domain.R;
import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO;
import com.op.system.api.domain.quality.QcCheckTaskWarehousingDTO;
import com.op.system.api.factory.RemoteDeviceFallbackFactory;
import com.op.system.api.factory.RemoteQualityFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;

@ -2,7 +2,6 @@ package com.op.system.api.factory;
import com.op.common.core.domain.R;
import com.op.system.api.RemoteDeviceService;
import com.op.system.api.RemoteQualityService;
import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO;
import com.op.system.api.domain.quality.QcCheckTaskWarehousingDTO;

@ -7,3 +7,4 @@ com.op.system.api.factory.RemoteTechnologyFallbackFactory
com.op.system.api.factory.RemoteSapFallbackFactory
com.op.system.api.factory.RemoteDeviceFallbackFactory
com.op.system.api.factory.RemoteQualityFallbackFactory
com.op.system.api.factory.RemoteOpenFallbackFactory

@ -55,4 +55,5 @@ public class ServiceNameConstants {
* serviceid
*/
public static final String OPEN_SERVICE = "op-open";
}

@ -0,0 +1,218 @@
package com.op.plan.controller;
import com.op.common.core.exception.ServiceException;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.web.page.TableDataInfo;
import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.plan.domain.ProOrderWorkorder;
import com.op.plan.domain.dto.SplitOrderDTO;
import com.op.plan.service.IProOrderWorkorderService;
import com.op.plan.service.IProWetMaterialPlanDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* Controller
*
* @author Open Platform
* @date 2023-07-26
*/
@RestController
@RequestMapping("/bppro/workorder")
public class ProBPOrderWorkorderController extends BaseController {
@Autowired
private IProOrderWorkorderService proOrderWorkorderService;
/**
* code
*
* @param code
* @return
*/
@GetMapping("/getWorkOrders/{code}")
public AjaxResult getWorkOrders(@PathVariable("code") String code) {
return proOrderWorkorderService.getWorkOrders(code);
}
/**
*
*
* @return
*/
@GetMapping("/checkWorkOrder/{id}")
public AjaxResult checkWorkOrder(@PathVariable("id") String id) {
return proOrderWorkorderService.checkWorkOrder(id);
}
/**
*
*
* @param splitOrderDTO
* @return
*/
@PostMapping("/subChangeWorkOrder")
@RequiresPermissions("mes:bppro:workorder:edit")
@Log(title = "修改工单", businessType = BusinessType.UPDATE)
public AjaxResult subChangeWorkOrder(@RequestBody SplitOrderDTO splitOrderDTO) {
return proOrderWorkorderService.subChangeWorkOrder(splitOrderDTO);
}
/**
* -
*
* @param splitOrderDTO
* @return
*/
@PostMapping("/subChangeWorkOrderM")
@RequiresPermissions("mes:bppro:workorder:edit")
public AjaxResult subChangeWorkOrderM(@RequestBody SplitOrderDTO splitOrderDTO) {
return proOrderWorkorderService.subChangeWorkOrderM(splitOrderDTO);
}
/**
* list
*
* @param proOrderWorkorder
* @return
*/
@PostMapping("/getWorkBatchList")
public AjaxResult getWorkBatchList(@RequestBody ProOrderWorkorder proOrderWorkorder) {
return proOrderWorkorderService.getWorkBatchList(proOrderWorkorder);
}
/**
*
*
* @param proOrderWorkorder
* @return
*/
@PostMapping("/getOrderAndWorkInfo")
public AjaxResult getOrderAndWorkInfo(@RequestBody ProOrderWorkorder proOrderWorkorder) {
return proOrderWorkorderService.getOrderAndWorkInfo(proOrderWorkorder);
}
/**
*
*/
@RequiresPermissions("mes:bppro:proworkorder:list")
@GetMapping("/list")
public TableDataInfo list(ProOrderWorkorder proOrderWorkorder) {
startPage();
List<ProOrderWorkorder> list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:bppro:workorder:export")
@Log(title = "生产工单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder);
ExcelUtil<ProOrderWorkorder> util = new ExcelUtil<ProOrderWorkorder>(ProOrderWorkorder.class);
util.exportExcel(response, list, "生产工单数据");
}
/**
*
*/
@RequiresPermissions("mes:bppro:workorder:query")
@GetMapping(value = "/{workorderId}")
public AjaxResult getInfo(@PathVariable("workorderId") String workorderId) {
return success(proOrderWorkorderService.selectProOrderWorkorderByWorkorderId(workorderId));
}
/**
*
*/
@RequiresPermissions("mes:bppro:workorder:add")
@Log(title = "生产工单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProOrderWorkorder proOrderWorkorder) {
return toAjax(proOrderWorkorderService.insertProOrderWorkorder(proOrderWorkorder));
}
/**
*
*/
@RequiresPermissions("mes:bppro:workorder:edit")
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProOrderWorkorder proOrderWorkorder) {
return toAjax(proOrderWorkorderService.updateProOrderWorkorder(proOrderWorkorder));
}
/**
*
*/
@RequiresPermissions("mes:bppro:workorder:remove")
@Log(title = "生产工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{workorderIds}")
public AjaxResult remove(@PathVariable String[] workorderIds) {
//没进入生产之前都可以删除
// 根据工单的ids查工单的信息
List<ProOrderWorkorder> proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds);
if (ObjectUtils.isEmpty(proOrderWorkorders)) {
throw new ServiceException("所查询的工单为空!!");
}
// 划分工单
List<ProOrderWorkorder> whiteWorkOrder = new ArrayList<>();
List<ProOrderWorkorder> proWorkOrder = new ArrayList<>();
for (ProOrderWorkorder data : proOrderWorkorders) {
if (data.getProdType().equals("white")) {
whiteWorkOrder.add(data);
}else {
proWorkOrder.add(data);
}
}
// 白坯检验逻辑
for (ProOrderWorkorder white : whiteWorkOrder) {
if (!(white.getStatus().equals("w0") || white.getStatus().equals("w1"))) {
throw new ServiceException("工单已进行生产,不允许删除!");
}
}
if (whiteWorkOrder.size() > 0) {
proOrderWorkorderService.deleteWhiteWorkorderByWorkOrder(whiteWorkOrder);
}
// 成品检验逻辑
ArrayList<String> strings = new ArrayList<>();
for (ProOrderWorkorder proOrderWorkorder : proWorkOrder) {
String status = proOrderWorkorder.getStatus();
if (status.equals("w0") || status.equals("w1")) {
strings.add(proOrderWorkorder.getWorkorderId());
} else {
throw new ServiceException("工单已进行生产,不允许删除!");
}
}
String[] orderWorkerIds = strings.toArray(new String[0]);
// 删除成品工单
if (orderWorkerIds.length > 0) {
proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds);
}
return toAjax(1);
}
/**
*
*/
@RequiresPermissions("mes:bppro:workorder:edit")
@Log(title = "下发生产工单", businessType = BusinessType.OTHER)
@PostMapping("/downWorkorder/{workorderIds}")
public AjaxResult downWorkorder(@PathVariable String[] workorderIds) {
return toAjax(proOrderWorkorderService.downProOrderWorkorderByWorkorderIds(workorderIds));
}
}

@ -167,5 +167,6 @@ public interface ProOrderWorkorderMapper {
ProOrderWorkorder getPWorkOrder(ProOrderWorkorder whiteOrder);
List<ProOrderWorkorder> selectProOrderWorkorderList999(ProOrderWorkorder proOrderWorkorder);
}

@ -93,7 +93,16 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
@Override
@DS("#header.poolName")
public List<ProOrderWorkorder> selectProOrderWorkorderList(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder);
List<ProOrderWorkorder> workorderList = null;
String key = "#header.poolName";
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String factoryCode = request.getHeader(key.substring(8)).replace("ds_","");
if("999".equals(factoryCode)){
workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList999(proOrderWorkorder);
}else{
workorderList = proOrderWorkorderMapper.selectProOrderWorkorderList(proOrderWorkorder);
}
for (ProOrderWorkorder workorder : workorderList) {
String prodLineName = "";
String equipCods = "'";

@ -49,7 +49,7 @@
select workorder_id, workorder_code, workorder_name, order_id, order_code, product_id, product_code, product_name,
product_spc, unit, quantity_produced, quantity_split, route_code, prod_line_code, product_date,
shift_id, parent_order, ancestors, status, remark, attr1, attr2, attr3, attr4, create_by, create_time,
update_by, update_time, prod_type, factory_code , end_flag , car_num,sort_no
update_by, update_time, prod_type, factory_code , end_flag , car_num,sort_no,workorder_code_sap
from pro_order_workorder
</sql>
@ -83,7 +83,40 @@
and pow.del_flag = '0' and ppow.del_flag = '0'
</where>
</select>
<select id="selectProOrderWorkorderList999" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
<where>
<if test="workorderCode != null and workorderCode != ''"> and workorder_code like concat('%', #{workorderCode}, '%')</if>
<if test="workorderName != null and workorderName != ''"> and workorder_name like concat('%', #{workorderName}, '%')</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="orderCode != null and orderCode != ''"> and order_code like concat('%', #{orderCode}, '%')</if>
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
<if test="productCode != null and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="productSpc != null and productSpc != ''"> and product_spc = #{productSpc}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="quantityProduced != null "> and quantity_produced = #{quantityProduced}</if>
<if test="quantitySplit != null "> and quantity_split = #{quantitySplit}</if>
<if test="routeCode != null and routeCode != ''"> and route_code = #{routeCode}</if>
<if test="prodLineCode != null and prodLineCode != ''"> and prod_line_code = #{prodLineCode}</if>
<if test="productDate != null "> and product_date = #{productDate}</if>
<if test="shiftId != null and shiftId != ''"> and shift_id = #{shiftId}</if>
<if test="parentOrder != null and parentOrder != ''"> and parent_order = #{parentOrder}</if>
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="statusArray != null and statusArray != ''"> and status in (${statusArray})</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="attr4 != null and attr4 != ''"> and attr4 = #{attr4}</if>
<if test="prodType != null and prodType != ''"> and prod_type = #{prodType}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="endFlag != null and endFlag != ''"> and end_flag = #{endFlag}</if>
<if test="productDateStart != null "> and CONVERT(varchar(10),product_date, 120) >= '${productDateStart}'</if>
<if test="productDateEnd != null "> and '${productDateEnd}%' >= CONVERT(varchar(10),product_date, 120)</if>
and del_flag = '0'
</where>
</select>
<select id="selectProOrderWorkorderByWorkorderId" parameterType="String" resultMap="ProOrderWorkorderResult">
<include refid="selectProOrderWorkorderVo"/>
where (workorder_code = #{workorderId} or workorder_id = #{workorderId})

@ -27,6 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="propertyCode" column="property_code" />
<result property="ruleName" column="rule_name" />
<result property="sort" column="sort" />
<result property="projectNo" column="project_no" />
</resultMap>
<sql id="selectQcCheckTypeProjectVo">
@ -39,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectQcCheckTypeProjectList" parameterType="QcCheckTypeProject" resultMap="QcCheckTypeProjectResult">
SELECT
ctp.id,
ctp.project_no,
ctp.project_id,
cp.rule_name,
cp.property_code,

Loading…
Cancel
Save