Merge remote-tracking branch 'origin/master'

master
Yangwl 11 months ago
commit 4e04cf0560

@ -52,7 +52,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService {
/**
*
* :/
* :/
* //*24
*
* @return

@ -123,8 +123,9 @@ public class EquSpotCheckServiceImpl implements IEquSpotCheckService {
* @return
*/
private AjaxResult formatEquItemCommon(List<EquPlanEqu> equPlanEquList, String planType, String message) {
//没有点检项的设备
String equipmentList = "";
for (EquPlanEqu data : equPlanEquList) {
// 检查项名称临时对象
StringBuilder itemTempName = new StringBuilder();
@ -169,9 +170,14 @@ public class EquSpotCheckServiceImpl implements IEquSpotCheckService {
data.setItemTempName(itemTempName.toString());//处理好的检查项名称置入检查项名称(用于前端信息回显)
} else {
// 未查询到对应检查项信息
return error(500, message);
equipmentList = equipmentList + '[' + data.getEquipmentCode() + "]";
}
}
if(!equipmentList.equals("")){
equipmentList = equipmentList + "设备未查询到对应检查项信息!";
message = equipmentList;
return error(500, message);
}
return success(equPlanEquList);
}

@ -48,8 +48,8 @@
be.equipment_name AS 'equipmentName',
be.equipment_status AS 'equipmentStatus',
be.department AS 'department',
ROUND(SUM(CAST(eo.fault_time AS FLOAT)) * 100 / SUM(CAST(eo.actual_operation_time AS FLOAT)),2) AS 'failureRate',
CAST(SUM(CAST(eo.actual_operation_time AS DECIMAL(10,2)))*100 / (365*24) AS DECIMAL(18,2)) AS 'utilizationRatio'
ROUND(SUM(CAST(eo.fault_time AS FLOAT)) * 100 / SUM(CAST(eo.operation_time AS FLOAT)),2) AS 'failureRate',
CAST(SUM(CAST(eo.actual_operation_time AS DECIMAL(10,2)))*100/(COUNT(eo.actual_operation_time)*24) AS DECIMAL(18,2)) AS 'utilizationRatio'
FROM equ_operation eo
LEFT JOIN base_equipment be ON eo.equipment_code = be.equipment_code
<where>

@ -191,9 +191,26 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
totals = mesMapper.getTotalNum(boardDTO);
everys = mesMapper.getEveryNum(boardDTO);
}
/**质量看板测试开始**/
if("equ_type_spj".equals(boardDTO.getEquTypeCode())){
boardDTO.setEquTypeCode("equ_type_hf");
totals = mesMapper.getTotalNum(boardDTO);
for(BoardDTO total:totals){
total.setTotalNum(total.getTotalNum()-2);
total.setEquTypeCode(total.getEquTypeCode().replace("H","X"));
total.setEquTypeName(total.getEquTypeName().replace("烘房","收坯机"));
}
everys = mesMapper.getEveryNum(boardDTO);
for(BoardDTO every:everys){
every.setTotalNum(every.getTotalNum()-2);
every.setEquCode(every.getEquCode().replace("H","X"));
every.setEquName(every.getEquName().replace("烘房","收坯机"));
}
}
/**质量看板测试结束**/
boardMap.put("totalNum", totals);
boardMap.put("everyNum", everys);
return boardMap;
}

@ -284,5 +284,21 @@ public class ProOrderController extends BaseController {
public R syncSAPOrders() {
return proOrderService.syncSAPOrders();
}
/**
* workorderIds
*/
@RequiresPermissions("mes:pro:order:edit")
@Log(title = "关闭订单", businessType = BusinessType.OTHER)
@PostMapping("/deleteOrder/{orderIds}")
public AjaxResult deleteOrder(@PathVariable String[] orderIds) {
int m = proOrderService.deleteOrder(orderIds);
if(m==2){
//有活动中的单
return AjaxResult.error("订单拆分成的工单,已经进行生产,不允许关闭,请联系系统管理员!");
}else if(m==1){
return AjaxResult.success("订单关闭成功");
}else{
return AjaxResult.error();
}
}
}

@ -142,7 +142,8 @@ public interface ProOrderMapper {
*/
public List<ProLine> selectPackageLine();
public void updateOrderBatch(@Param("workers") List<ProOrderWorkorder> workers);
public int updateOrderBatch(@Param("workers") List<ProOrderWorkorder> workers);
public int updateCloseOrderBatch(@Param("workers") List<ProOrderWorkorder> workers);
/**
* id

@ -184,5 +184,11 @@ public interface ProOrderWorkorderMapper {
ProOrderWorkorder getSonWorkOrder(ProOrderWorkorder whiteOrder);
ProOrderWorkorder selectSonWorkOrder(String workorderCode);
List<ProOrderWorkorder> getWorkOrderByOrders(@Param("orderIds")String[] orderIds);
int deletePrepareBatch(@Param("workorders")List<String> workorders);
int deletePrepareDetailBatch(@Param("workorders")List<String> workorders);
}

@ -141,4 +141,6 @@ public interface IProOrderService {
AjaxResult getCascadeProOrder(String orderCode);
int getProSortNo(ProOrder proOrder);
int deleteOrder(String[] orderCodes);
}

@ -32,6 +32,7 @@ import com.op.system.api.RemoteSapService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysSapLog;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.sap.SapCloseOrderQuery;
import com.op.system.api.domain.sap.SapShopOrderQuery;
import com.op.system.api.model.SapProOrder;
import org.apache.commons.lang3.time.DateFormatUtils;
@ -1084,6 +1085,87 @@ public class ProOrderServiceImpl implements IProOrderService {
}
return success();
}
@Override
@DS("#header.poolName")
@Transactional(rollbackFor = Exception.class)
public int deleteOrder(String[] orderIds) {
//可以进行订单关闭的数据
List<ProOrderWorkorder> checkWorkOrders = proOrderWorkorderMapper.getWorkOrderByOrders(orderIds);
if(checkWorkOrders.size() != orderIds.length){
return 2;
}
for(ProOrderWorkorder workorder:checkWorkOrders){
//要删除的工单id们
List<String> delteIds = new ArrayList<>();
delteIds.add(workorder.getWorkorderId());
//关闭订单用
List<String> ordercodes = new ArrayList<>();
ordercodes.add(workorder.getWorkorderCodeSap());
//删领料单用
List<String> workorderCodes = new ArrayList<>();
workorderCodes.add(workorder.getWorkorderCode());
//删除订单
List<ProOrderWorkorder> workers = new ArrayList<>();
workers.add(workorder);
ProOrderWorkorder topWork = workorder;
Boolean run = true;
while (run) {
//下级
ProOrderWorkorder sonWorkers = proOrderWorkorderMapper.selectSonWorkOrder(topWork.getWorkorderCode());
//有上级code
if (sonWorkers != null) {
workers.add(sonWorkers);
delteIds.add(sonWorkers.getWorkorderId());
ordercodes.add(sonWorkers.getWorkorderCodeSap());
workorderCodes.add(sonWorkers.getWorkorderCode());
topWork.setWorkorderCode(sonWorkers.getWorkorderCode());
} else {
run = false;
}
}
//调用sap订单关闭接口
//关闭母子订单//订单的订单编码(关闭订单暂时隐藏)
SapCloseOrderQuery sapCloseOrderQuery = new SapCloseOrderQuery();
sapCloseOrderQuery.setOrderCodes(ordercodes);
R closeR= remoteSapService.sapCloseOrder(sapCloseOrderQuery);
logger.info(workorderCodes.get(0)+"删除订单后关闭订单"+
JSONObject.toJSONString(sapCloseOrderQuery)+
closeR.getCode()+","+
closeR.getMsg()+","+
closeR.getData());
//if(closeR.getCode()==200){
String[] workorderIds = (String[]) delteIds.toArray(new String[delteIds.size()]);
if (workorderIds.length > 0) {
//删除工单(字母)pro_order_workorder
int m1 = proOrderWorkorderMapper.deleteProOrderWorkorderByWorkorderIds(workorderIds);
logger.info(workorderCodes.get(0)+"删除订单m1:"+m1);
//删除批次pro_order_workorder_batch
int m2 = proOrderWorkorderBatchMapper.deleteBatch(workorderIds);
logger.info(workorderCodes.get(0)+"删除订单m2:"+m2);
//删除领料单mes_prepare
int m3 = proOrderWorkorderMapper.deletePrepareBatch(workorderCodes);
logger.info(workorderCodes.get(0)+"删除订单m3:"+m3);
//删除领料单明细mes_prepare_detail
int m4 = proOrderWorkorderMapper.deletePrepareDetailBatch(workorderCodes);
logger.info(workorderCodes.get(0)+"删除订单m4:"+m4);
}
if (!CollectionUtils.isEmpty(workers)) {
//删除订单pro_order
int m5 = proOrderMapper.updateCloseOrderBatch(workers);
logger.info(workorderCodes.get(0)+"删除订单m5:"+m5);
}
// }else{
// logger.info(workorder.getWorkorderCode()+"删除订单后关闭订单sap返回结果"+
// JSONObject.toJSONString(closeR));
// return 0;
// }
}
return 1;
}
public static void main(String args[]){
String arrayStr = "[[\"GX01\",\"LG1\"],[\"GX01\",\"LG2\"],[\"GX02\",\"S1\"],[\"GX02\",\"S2\"],[\"GX03\",\"HF01\"],[\"GX04\",\"SPJ01\"]]";
JSONArray jsonArray = JSONArray.parseArray(arrayStr);

@ -321,7 +321,13 @@
where id = #{worker.orderId}
</foreach>
</update>
<update id="updateCloseOrderBatch">
<foreach collection="workers" item="worker" index="index" separator=";">
update pro_order set del_flag = '1',
update_time = GETDATE()
where id = #{worker.orderId}
</foreach>
</update>
<update id="updateProOrderByOrderCode" parameterType="ProOrder">
update pro_order
<trim prefix="SET" suffixOverrides=",">

@ -507,6 +507,22 @@
from pro_wet_material_plan_detail
where workorder_id = #{workorderId} and del_flag = '0'
</select>
<select id="getWorkOrderByOrders" resultType="com.op.plan.domain.ProOrderWorkorder">
select workorder_id workorderId,
workorder_code workorderCode,
order_code orderCode,
order_id orderId,
quantity_split quantitySplit,
workorder_code_sap workorderCodeSap
from pro_order_workorder pow
where pow.order_id in
<foreach item="orderId" collection="orderIds" open="(" separator="," close=")">
#{orderId}
</foreach>
and pow.status in ('w0','w1')
and pow.del_flag = '0'
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail
@ -705,4 +721,22 @@
#{orderId}
</foreach>
</delete>
<delete id="deletePrepareBatch">
update mes_prepare
set del_flag = '1',
update_time = GETDATE()
where workorder_code in
<foreach item="workorder" collection="workorders" open="(" separator="," close=")">
#{workorder}
</foreach>
</delete>
<delete id="deletePrepareDetailBatch">
update mes_prepare_detail
set del_flag = '1',
update_time = GETDATE()
where parent_work_order in
<foreach item="workorder" collection="workorders" open="(" separator="," close=")">
#{workorder}
</foreach>
</delete>
</mapper>

@ -9,7 +9,7 @@ import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcGoal;
//import com.op.quality.service.IQcGoalService;
import com.op.quality.service.IQcGoalService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
@ -24,103 +24,103 @@ import com.op.common.core.web.page.TableDataInfo;
@RestController
@RequestMapping("/qcGoal")
public class QcGoalController extends BaseController {
// @Autowired
// private IQcGoalService qcGoalService;
//
// /**
// * 查询质量目标列表
// */
// @RequiresPermissions("quality:qcGoal:list")
// @GetMapping("/list")
// public TableDataInfo list(QcGoal qcGoal) {
// startPage();
// List<QcGoal> list = qcGoalService.selectQcGoalList(qcGoal);
// return getDataTable(list);
// }
//
// /**
// * 查询二级质量目标
// */
// @GetMapping("/getChildrenList/{parentId}")
// public List<QcGoal> getChildrenList(@PathVariable("parentId") String parentId) {
// QcGoal goal = new QcGoal();
// goal.setParentGoal(parentId);
// List<QcGoal> list = qcGoalService.selectChildrenByParent(goal);
// return list;
// }
//
// /**
// * 导出质量目标列表
// */
// @RequiresPermissions("quality:qcGoal:export")
// @Log(title = "质量目标", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, QcGoal qcGoal) {
// List<QcGoal> list = qcGoalService.selectQcGoalList(qcGoal);
// ExcelUtil<QcGoal> util = new ExcelUtil<QcGoal>(QcGoal. class);
// util.exportExcel(response, list, "质量目标数据");
// }
//
// /**
// * 获取质量目标详细信息
// */
// @RequiresPermissions("quality:qcGoal:query")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") String id) {
// return success(qcGoalService.selectQcGoalById(id));
// }
//
// /**
// * 获取质量目标下拉树列表
// */
// @GetMapping("/treeSelect")
// public AjaxResult treeSelect(QcGoal qcGoal) {
// List<QcGoal> qcGoals = qcGoalService.selectQcGoalList(qcGoal);
// return success(qcGoalService.buildQcGoalTreeSelect(qcGoals));
// }
//
// /**
// * 新增质量目标
// */
// @RequiresPermissions("quality:qcGoal:add")
// @Log(title = "质量目标", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody QcGoal qcGoal) {
// return toAjax(qcGoalService.insertQcGoal(qcGoal));
// }
//
// /**
// * 拆解质量目标
// */
// @GetMapping("/generate/{id}")
// public TableDataInfo generate(@PathVariable("id") String id) {
// List<QcGoal> qcGoalList = qcGoalService.generate(id);
// return getDataTable(qcGoalList);
// }
//
//
// /**
// * 修改质量目标
// */
// @RequiresPermissions("quality:qcGoal:edit")
// @Log(title = "质量目标", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody QcGoal qcGoal) {
// return toAjax(qcGoalService.updateQcGoal(qcGoal));
// }
//
// /**
// * 删除质量目标
// */
// @RequiresPermissions("quality:qcGoal:remove")
// @Log(title = "质量目标", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable String[] ids) {
// int rows = qcGoalService.deleteQcGoalByIds(ids);
// if (rows > 0 ) {
// return success("操作成功");
// }else {
// return error("操作失败,请检查要删除的项目是否含有子项目");
// }
// }
@Autowired
private IQcGoalService qcGoalService;
/**
*
*/
@RequiresPermissions("quality:qcGoal:list")
@GetMapping("/list")
public TableDataInfo list(QcGoal qcGoal) {
startPage();
List<QcGoal> list = qcGoalService.selectQcGoalList(qcGoal);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/getChildrenList/{parentId}")
public List<QcGoal> getChildrenList(@PathVariable("parentId") String parentId) {
QcGoal goal = new QcGoal();
goal.setParentGoal(parentId);
List<QcGoal> list = qcGoalService.selectChildrenByParent(goal);
return list;
}
/**
*
*/
@RequiresPermissions("quality:qcGoal:export")
@Log(title = "质量目标", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcGoal qcGoal) {
List<QcGoal> list = qcGoalService.selectQcGoalList(qcGoal);
ExcelUtil<QcGoal> util = new ExcelUtil<QcGoal>(QcGoal. class);
util.exportExcel(response, list, "质量目标数据");
}
/**
*
*/
@RequiresPermissions("quality:qcGoal:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(qcGoalService.selectQcGoalById(id));
}
/**
*
*/
@GetMapping("/treeSelect")
public AjaxResult treeSelect(QcGoal qcGoal) {
List<QcGoal> qcGoals = qcGoalService.selectQcGoalList(qcGoal);
return success(qcGoalService.buildQcGoalTreeSelect(qcGoals));
}
/**
*
*/
@RequiresPermissions("quality:qcGoal:add")
@Log(title = "质量目标", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcGoal qcGoal) {
return toAjax(qcGoalService.insertQcGoal(qcGoal));
}
/**
*
*/
@GetMapping("/generate/{id}")
public TableDataInfo generate(@PathVariable("id") String id) {
List<QcGoal> qcGoalList = qcGoalService.generate(id);
return getDataTable(qcGoalList);
}
/**
*
*/
@RequiresPermissions("quality:qcGoal:edit")
@Log(title = "质量目标", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcGoal qcGoal) {
return toAjax(qcGoalService.updateQcGoal(qcGoal));
}
/**
*
*/
@RequiresPermissions("quality:qcGoal:remove")
@Log(title = "质量目标", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
int rows = qcGoalService.deleteQcGoalByIds(ids);
if (rows > 0 ) {
return success("操作成功");
}else {
return error("操作失败,请检查要删除的项目是否含有子项目");
}
}
}

@ -3,7 +3,6 @@ package com.op.quality.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.quality.domain.QcGoal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -17,7 +16,7 @@ import com.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.quality.domain.QcGoalDistribute;
//import com.op.quality.service.IQcGoalDistributeService;
import com.op.quality.service.IQcGoalDistributeService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
@ -32,87 +31,107 @@ import com.op.common.core.web.page.TableDataInfo;
@RestController
@RequestMapping("/qcGoalDistribute")
public class QcGoalDistributeController extends BaseController {
// @Autowired
// private IQcGoalDistributeService qcGoalDistributeService;
//
///**
// * 查询质量目标分配列表
// */
//@RequiresPermissions("quality:qcGoalDistribute:list")
//@GetMapping("/list")
// public TableDataInfo list(QcGoalDistribute qcGoalDistribute) {
// startPage();
// List<QcGoalDistribute> list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute);
// return getDataTable(list);
// }
//
// /**
// * 导出质量目标分配列表
// */
// @RequiresPermissions("quality:qcGoalDistribute:export")
// @Log(title = "质量目标分配", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, QcGoalDistribute qcGoalDistribute) {
// List<QcGoalDistribute> list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute);
// ExcelUtil<QcGoalDistribute> util = new ExcelUtil<QcGoalDistribute>(QcGoalDistribute. class);
// util.exportExcel(response, list, "质量目标分配数据");
// }
//
// /**
// * 获取质量目标分配详细信息
// */
// @RequiresPermissions("quality:qcGoalDistribute:query")
// @GetMapping(value = "/{id}")
// public AjaxResult getInfo(@PathVariable("id") String id) {
// return success(qcGoalDistributeService.selectQcGoalDistributeById(id));
// }
//
// /**
// * 新增质量目标分配
// */
// @Log(title = "质量目标分配", businessType = BusinessType.INSERT)
// @PostMapping
// public AjaxResult add(@RequestBody QcGoalDistribute qcGoalDistribute) {
// return toAjax(qcGoalDistributeService.insertQcGoalDistribute(qcGoalDistribute));
// }
//
// /**
// * 修改质量目标分配
// */
// @RequiresPermissions("quality:qcGoalDistribute:edit")
// @Log(title = "质量目标分配", businessType = BusinessType.UPDATE)
// @PutMapping
// public AjaxResult edit(@RequestBody QcGoalDistribute qcGoalDistribute) {
// return toAjax(qcGoalDistributeService.updateQcGoalDistribute(qcGoalDistribute));
// }
//
// /**
// * 删除质量目标分配
// */
// @RequiresPermissions("quality:qcGoalDistribute:remove")
// @Log(title = "质量目标分配", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable String[] ids) {
// return toAjax(qcGoalDistributeService.deleteQcGoalDistributeByIds(ids));
// }
// /**
// * 获取未分配供应商数据
// */
// @GetMapping(value = "/getLeftList")
// public TableDataInfo getLeftList(QcGoalDistribute qcGoalDistribute) {
// startPage();
// List<QcGoalDistribute> list = qcGoalDistributeService.getLeftList(qcGoalDistribute);
// return getDataTable(list);
// }
//
// /**
// * 获取已分配供应商数据
// */
// @GetMapping(value = "/getRightList")
// public TableDataInfo getRightList(QcGoalDistribute qcGoalDistribute) {
// startPage();
// List<QcGoalDistribute> list = qcGoalDistributeService.getRightList(qcGoalDistribute);
// return getDataTable(list);
// }
@Autowired
private IQcGoalDistributeService qcGoalDistributeService;
/**
*
*/
@RequiresPermissions("quality:qcGoalDistribute:list")
@GetMapping("/list")
public TableDataInfo list(QcGoalDistribute qcGoalDistribute) {
startPage();
List<QcGoalDistribute> list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("quality:qcGoalDistribute:export")
@Log(title = "质量目标分配", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, QcGoalDistribute qcGoalDistribute) {
List<QcGoalDistribute> list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute);
ExcelUtil<QcGoalDistribute> util = new ExcelUtil<QcGoalDistribute>(QcGoalDistribute. class);
util.exportExcel(response, list, "质量目标分配数据");
}
/**
*
*/
@RequiresPermissions("quality:qcGoalDistribute:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return success(qcGoalDistributeService.selectQcGoalDistributeById(id));
}
/**
*
*/
@Log(title = "质量目标分配", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody QcGoalDistribute qcGoalDistribute) {
return toAjax(qcGoalDistributeService.insertQcGoalDistribute(qcGoalDistribute));
}
/**
*
*/
@RequiresPermissions("quality:qcGoalDistribute:edit")
@Log(title = "质量目标分配", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody QcGoalDistribute qcGoalDistribute) {
return toAjax(qcGoalDistributeService.updateQcGoalDistribute(qcGoalDistribute));
}
/**
*
*/
@RequiresPermissions("quality:qcGoalDistribute:remove")
@Log(title = "质量目标分配", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(qcGoalDistributeService.deleteQcGoalDistributeByIds(ids));
}
/**
*
*/
@GetMapping(value = "/getLeftList")
public TableDataInfo getLeftList(QcGoalDistribute qcGoalDistribute) {
startPage();
List<QcGoalDistribute> list = qcGoalDistributeService.getLeftList(qcGoalDistribute);
return getDataTable(list);
}
/**
*
*/
@GetMapping(value = "/getRightList")
public TableDataInfo getRightList(QcGoalDistribute qcGoalDistribute) {
startPage();
List<QcGoalDistribute> list = qcGoalDistributeService.getRightList(qcGoalDistribute);
return getDataTable(list);
}
/**
*
*/
@GetMapping(value = "/getProductLeftList")
public TableDataInfo getProductLeftList(QcGoalDistribute qcGoalDistribute) {
startPage();
List<QcGoalDistribute> list = qcGoalDistributeService.getProductLeftList(qcGoalDistribute);
return getDataTable(list);
}
/**
*
*/
@GetMapping(value = "/getProductRightList")
public TableDataInfo getProductRightList(QcGoalDistribute qcGoalDistribute) {
startPage();
List<QcGoalDistribute> list = qcGoalDistributeService.getProductRightList(qcGoalDistribute);
return getDataTable(list);
}
}

@ -252,6 +252,13 @@ public class QuaController extends BaseController {
return qcCheckTaskIncomeService.getDefectListPDA(qcDefectType);
}
/**检测地点编码名称**/
@PostMapping("/getCheckLocList")
public List<QcDefectType> getCheckLocList(@RequestBody QcDefectType qcDefectType) {
DynamicDataSourceContextHolder.push(qcDefectType.getFactoryCode());
return qcCheckTaskIncomeService.getCheckLocList(qcDefectType);
}
/**获取生产工单列表**/
@GetMapping("/getWorkOrder")
public TableDataInfo getWorkOrder(QcCheckTaskIncome qcCheckTaskIncome) {

@ -108,4 +108,6 @@ public interface QcCheckTaskIncomeMapper {
List<QcCheckTaskIncome> getIncomeBatchList();
int updateIncomeBatchList(@Param("list") List<String> batchRecordIds, @Param("time") Date taskTime);
List<QcDefectType> getCheckLocList(QcDefectType qcDefectType);
}

@ -66,5 +66,8 @@ public interface QcGoalDistributeMapper {
public List<QcGoalDistribute> getGoalDistributeUndo(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getGoalDistributeDo(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getProductUndo(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getProductDo(QcGoalDistribute qcGoalDistribute);
}

@ -96,4 +96,6 @@ public interface IQcCheckTaskIncomeService {
List<QcCheckTaskIncome> getIncomeBatchList(String poolName);
int updateIncomeBatchList(List<String> batchRecordIds , Date taskTime);
List<QcDefectType> getCheckLocList(QcDefectType qcDefectType);
}

@ -0,0 +1,67 @@
package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcGoalDistribute;
/**
* Service
*
* @author Open Platform
* @date 2024-03-07
*/
public interface IQcGoalDistributeService {
/**
*
*
* @param id
* @return
*/
public QcGoalDistribute selectQcGoalDistributeById(String id);
/**
*
*
* @param qcGoalDistribute
* @return
*/
public List<QcGoalDistribute> selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute);
/**
*
*
* @param qcGoalDistribute
* @return
*/
public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute);
/**
*
*
* @param qcGoalDistribute
* @return
*/
public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute);
/**
*
*
* @param ids
* @return
*/
public int deleteQcGoalDistributeByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteQcGoalDistributeById(String id);
public List<QcGoalDistribute> getLeftList(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getRightList(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getProductLeftList(QcGoalDistribute qcGoalDistribute);
public List<QcGoalDistribute> getProductRightList(QcGoalDistribute qcGoalDistribute);
}

@ -0,0 +1,85 @@
package com.op.quality.service;
import java.util.List;
import com.op.quality.domain.QcGoal;
import com.op.quality.domain.vo.TreeSelect;
/**
* Service
*
* @author Open Platform
* @date 2024-03-04
*/
public interface IQcGoalService {
/**
*
*
* @param id
* @return
*/
public QcGoal selectQcGoalById(String id);
/**
*
*
* @param qcGoal
* @return
*/
public List<QcGoal> selectQcGoalList(QcGoal qcGoal);
/**
*
* @param goal
* @return
*/
public List<QcGoal> selectChildrenByParent(QcGoal goal);
/**
*
* @param qcGoals
* @return
*/
public List<TreeSelect> buildQcGoalTreeSelect(List<QcGoal> qcGoals);
/**
*
*
* @param qcGoal
* @return
*/
public int insertQcGoal(QcGoal qcGoal);
public List<QcGoal> generate(String id);
/**
*
*
* @param qcGoal
* @return
*/
public int updateQcGoal(QcGoal qcGoal);
/**
*
*
* @param ids
* @return
*/
public int deleteQcGoalByIds(String[] ids);
/**
*
*
* @param id
* @return
*/
public int deleteQcGoalById(String id);
/**
*
* @param qcGoals
* @return
*/
public List<QcGoal> buildGoalTree(List<QcGoal> qcGoals);
}

@ -721,4 +721,11 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
public int updateIncomeBatchList(List<String> batchRecordIds , Date taskTime){
return qcCheckTaskIncomeMapper.updateIncomeBatchList(batchRecordIds ,taskTime);
}
@Override
public List<QcDefectType> getCheckLocList(QcDefectType qcDefectType) {
return qcCheckTaskIncomeMapper.getCheckLocList(qcDefectType);
}
}

@ -1,153 +1,174 @@
//package com.op.quality.service.impl;
//
//import java.util.Date;
//import java.util.List;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.op.common.core.utils.DateUtils;
//import com.op.common.core.utils.StringUtils;
//import com.op.common.core.utils.uuid.IdUtils;
//import com.op.common.security.utils.SecurityUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.op.quality.mapper.QcGoalDistributeMapper;
//import com.op.quality.domain.QcGoalDistribute;
//import com.op.quality.service.IQcGoalDistributeService;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * 质量目标分配Service业务层处理
// *
// * @author Open Platform
// * @date 2024-03-07
// */
//@Service
//public class QcGoalDistributeServiceImpl implements IQcGoalDistributeService {
// @Autowired
// private QcGoalDistributeMapper qcGoalDistributeMapper;
//
// /**
// * 查询质量目标分配
// *
// * @param id 质量目标分配主键
// * @return 质量目标分配
// */
// @Override
// @DS("#header.poolName")
// public QcGoalDistribute selectQcGoalDistributeById(String id) {
// return qcGoalDistributeMapper.selectQcGoalDistributeById(id);
// }
//
// /**
// * 查询质量目标分配列表
// *
// * @param qcGoalDistribute 质量目标分配
// * @return 质量目标分配
// */
// @Override
// @DS("#header.poolName")
// public List<QcGoalDistribute> selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute) {
// return qcGoalDistributeMapper.selectQcGoalDistributeList(qcGoalDistribute);
// }
//
// /**
// * 新增质量目标分配
// *
// * @param qcGoalDistribute 质量目标分配
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute) {
//
// if (StringUtils.isNotEmpty(qcGoalDistribute.getBelongGoalId())) {
// qcGoalDistributeMapper.deleteQcGoalDistributeByBelongId(qcGoalDistribute.getBelongGoalId());
// }
// int count = 0;
// if (qcGoalDistribute.getSelectedValues().size() > 0){
// QcGoalDistribute dto = null;
// Date now = DateUtils.getNowDate();
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// String key = "#header.poolName";
// String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
// for (String supplierCode : qcGoalDistribute.getSelectedValues()) {
// dto = new QcGoalDistribute();
// dto.setId(IdUtils.fastSimpleUUID());
// dto.setCreateTime(now);
// dto.setCreateBy(SecurityUtils.getUsername());
// dto.setBelongGoalId(qcGoalDistribute.getBelongGoalId());
// dto.setSupplierCode(supplierCode);
// dto.setFactoryCode(factoryCode);
// count += qcGoalDistributeMapper.insertQcGoalDistribute(dto);
// }
// }else {
// count = 1;
// }
// return count;
// }
//
// /**
// * 修改质量目标分配
// *
// * @param qcGoalDistribute 质量目标分配
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute) {
// qcGoalDistribute.setUpdateTime(DateUtils.getNowDate());
// return qcGoalDistributeMapper.updateQcGoalDistribute(qcGoalDistribute);
// }
//
// /**
// * 批量删除质量目标分配
// *
// * @param ids 需要删除的质量目标分配主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalDistributeByIds(String[] ids) {
// return qcGoalDistributeMapper.deleteQcGoalDistributeByIds(ids);
// }
//
// /**
// * 删除质量目标分配信息
// *
// * @param id 质量目标分配主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalDistributeById(String id) {
// return qcGoalDistributeMapper.deleteQcGoalDistributeById(id);
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoalDistribute> getLeftList(QcGoalDistribute qcGoalDistribute) {
// List<QcGoalDistribute> dto = qcGoalDistributeMapper.getGoalDistributeUndo(qcGoalDistribute);
// List<QcGoalDistribute> selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute);
// dto.addAll(selected);
// dto.forEach(item -> {
// item.setKey(item.getSupplierCode());
// });
// return dto;
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoalDistribute> getRightList(QcGoalDistribute qcGoalDistribute) {
// List<QcGoalDistribute> selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute);
// selected.forEach(item -> {
// item.setKey(item.getSupplierCode());
// });
// return selected;
// }
//
//
//
//}
package com.op.quality.service.impl;
import java.util.Date;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcGoalDistributeMapper;
import com.op.quality.domain.QcGoalDistribute;
import com.op.quality.service.IQcGoalDistributeService;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Service
*
* @author Open Platform
* @date 2024-03-07
*/
@Service
public class QcGoalDistributeServiceImpl implements IQcGoalDistributeService {
@Autowired
private QcGoalDistributeMapper qcGoalDistributeMapper;
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public QcGoalDistribute selectQcGoalDistributeById(String id) {
return qcGoalDistributeMapper.selectQcGoalDistributeById(id);
}
/**
*
*
* @param qcGoalDistribute
* @return
*/
@Override
@DS("#header.poolName")
public List<QcGoalDistribute> selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute) {
return qcGoalDistributeMapper.selectQcGoalDistributeList(qcGoalDistribute);
}
/**
*
*
* @param qcGoalDistribute
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute) {
if (StringUtils.isNotEmpty(qcGoalDistribute.getBelongGoalId())) {
qcGoalDistributeMapper.deleteQcGoalDistributeByBelongId(qcGoalDistribute.getBelongGoalId());
}
int count = 0;
if (qcGoalDistribute.getSelectedValues().size() > 0){
QcGoalDistribute dto = null;
Date now = DateUtils.getNowDate();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
String factoryCode = request.getHeader(key.substring(8)).replace("ds_", "");
for (String supplierCode : qcGoalDistribute.getSelectedValues()) {
dto = new QcGoalDistribute();
dto.setId(IdUtils.fastSimpleUUID());
dto.setCreateTime(now);
dto.setCreateBy(SecurityUtils.getUsername());
dto.setBelongGoalId(qcGoalDistribute.getBelongGoalId());
dto.setSupplierCode(supplierCode);
dto.setFactoryCode(factoryCode);
count += qcGoalDistributeMapper.insertQcGoalDistribute(dto);
}
}else {
count = 1;
}
return count;
}
/**
*
*
* @param qcGoalDistribute
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute) {
qcGoalDistribute.setUpdateTime(DateUtils.getNowDate());
return qcGoalDistributeMapper.updateQcGoalDistribute(qcGoalDistribute);
}
/**
*
*
* @param ids
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcGoalDistributeByIds(String[] ids) {
return qcGoalDistributeMapper.deleteQcGoalDistributeByIds(ids);
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcGoalDistributeById(String id) {
return qcGoalDistributeMapper.deleteQcGoalDistributeById(id);
}
@Override
@DS("#header.poolName")
public List<QcGoalDistribute> getLeftList(QcGoalDistribute qcGoalDistribute) {
List<QcGoalDistribute> dto = qcGoalDistributeMapper.getGoalDistributeUndo(qcGoalDistribute);
List<QcGoalDistribute> selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute);
dto.addAll(selected);
dto.forEach(item -> {
item.setKey(item.getSupplierCode());
});
return dto;
}
@Override
@DS("#header.poolName")
public List<QcGoalDistribute> getRightList(QcGoalDistribute qcGoalDistribute) {
List<QcGoalDistribute> selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute);
selected.forEach(item -> {
item.setKey(item.getSupplierCode());
});
return selected;
}
@Override
@DS("#header.poolName")
public List<QcGoalDistribute> getProductLeftList(QcGoalDistribute qcGoalDistribute) {
List<QcGoalDistribute> dto = qcGoalDistributeMapper.getProductUndo(qcGoalDistribute);
List<QcGoalDistribute> selected = qcGoalDistributeMapper.getProductDo(qcGoalDistribute);
dto.addAll(selected);
dto.forEach(item -> {
item.setKey(item.getSupplierCode());
});
return dto;
}
@Override
@DS("#header.poolName")
public List<QcGoalDistribute> getProductRightList(QcGoalDistribute qcGoalDistribute) {
List<QcGoalDistribute> selected = qcGoalDistributeMapper.getProductDo(qcGoalDistribute);
selected.forEach(item -> {
item.setKey(item.getSupplierCode());
});
return selected;
}
}

@ -1,245 +1,245 @@
//package com.op.quality.service.impl;
//
//import java.math.BigDecimal;
//import java.util.ArrayList;
//import java.util.Date;
//import java.util.Iterator;
//import java.util.List;
//import java.util.stream.Collectors;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.op.common.core.utils.DateUtils;
//import com.op.common.security.utils.SecurityUtils;
//import com.op.quality.domain.vo.TreeSelect;
//import com.sun.xml.bind.v2.TODO;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.op.quality.mapper.QcGoalMapper;
//import com.op.quality.domain.QcGoal;
//import com.op.quality.service.IQcGoalService;
//import org.springframework.util.ObjectUtils;
//import org.springframework.web.context.request.RequestContextHolder;
//import org.springframework.web.context.request.ServletRequestAttributes;
//
//import javax.servlet.http.HttpServletRequest;
//
///**
// * 质量目标Service业务层处理
// *
// * @author Open Platform
// * @date 2024-03-04
// */
//@Service
//public class QcGoalServiceImpl implements IQcGoalService {
// @Autowired
// private QcGoalMapper qcGoalMapper;
//
// /**
// * 查询质量目标
// *
// * @param id 质量目标主键
// * @return 质量目标
// */
// @Override
// @DS("#header.poolName")
// public QcGoal selectQcGoalById(String id) {
// return qcGoalMapper.selectQcGoalById(id);
// }
//
// /**
// * 查询质量目标列表
// *
// * @param qcGoal 质量目标
// * @return 质量目标
// */
// @Override
// @DS("#header.poolName")
// public List<QcGoal> selectQcGoalList(QcGoal qcGoal) {
// List<QcGoal> qcGoals = qcGoalMapper.selectQcGoalList(qcGoal);
// for (QcGoal item : qcGoals) {
// item.setHasChildren(true);
// }
// return qcGoals;
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoal> selectChildrenByParent(QcGoal goal) {
// return qcGoalMapper.selectChildrenByParent(goal);
// }
//
// @Override
// @DS("#header.poolName")
// public List<TreeSelect> buildQcGoalTreeSelect(List<QcGoal> qcGoals) {
// List<QcGoal> qcGoalTrees = buildGoalTree(qcGoals);
// return qcGoalTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
// }
//
// /**
// * 新增质量目标
// *
// * @param qcGoal 质量目标
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int insertQcGoal(QcGoal qcGoal) {
// qcGoal.setCreateTime(DateUtils.getNowDate());
// qcGoal.setCreateBy(SecurityUtils.getUsername());
//
// qcGoal.setId(getSerialNumber(qcGoal));
// qcGoal.setFactoryCode(getFactoryCode());
// qcGoal.setParentGoal("0");
//
// return qcGoalMapper.insertQcGoal(qcGoal);
// }
//
// @Override
// @DS("#header.poolName")
// public List<QcGoal> generate(String id) {
// QcGoal goal = qcGoalMapper.selectQcGoalById(id);
// List<QcGoal> genResult = new ArrayList<>();
//
// // 提前分配大小,有助于减少不必要的计算和内存分配,从而提高代码的性能。
// String goalYm = goal.getGoalYm();
// BigDecimal nookQualityRate = goal.getNookQualityRate();
// BigDecimal nookRate = goal.getNookRate();
// String checkType = goal.getCheckType();
// String typeCode = goal.getTypeCode();
// String factoryCode = getFactoryCode();
// String username = SecurityUtils.getUsername();
// Date nowDate = DateUtils.getNowDate();
// String parentGoal = goal.getId();
//
//
// int liushuiNum = qcGoalMapper.getTodayMaxNum(goal);
// String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
//
// int month = 12;
// for (int i = 1; i <= month; i++) {
// QcGoal monthGoal = new QcGoal();
//
// String liushuiStr = String.format("%04d", liushuiNum+i-1);
// monthGoal.setId(dateNumber+liushuiStr);
// String mon = String.format("%02d",i);
// monthGoal.setGoalYm(goalYm+"-"+mon);
// monthGoal.setGoalType("mm");
// monthGoal.setNookQualityRate(nookQualityRate);
// monthGoal.setNookRate(nookRate);
// monthGoal.setCheckType(checkType);
// monthGoal.setTypeCode(typeCode);
// monthGoal.setScope(goal.getScope());
// monthGoal.setCreateTime(nowDate);
// monthGoal.setCreateBy(username);
// monthGoal.setFactoryCode(factoryCode);
// monthGoal.setParentGoal(parentGoal);
// genResult.add(monthGoal);
// }
// // 批量插入
// int flag = qcGoalMapper.insertQcGoalList(genResult);
// if (flag > 0) {
// return genResult;
// }else {
// return goal.getChildren();
// }
//
// }
//
// /**
// * 修改质量目标
// *
// * @param qcGoal 质量目标
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int updateQcGoal(QcGoal qcGoal) {
// qcGoal.setUpdateTime(DateUtils.getNowDate());
// qcGoal.setUpdateBy(SecurityUtils.getUsername());
// return qcGoalMapper.updateQcGoal(qcGoal);
// }
//
// /**
// * 批量删除质量目标
// *
// * @param ids 需要删除的质量目标主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalByIds(String[] ids) {
// boolean flag = false;
// for (String id : ids) {
// QcGoal goal = new QcGoal();
// goal.setParentGoal(id);
// List<QcGoal> hasChildren = qcGoalMapper.selectChildrenByParent(goal);
// if (hasChildren.size() > 0) {
// flag = true;
// break;
// }
// }
// if (flag) {
// return 0;
// }else {
// return qcGoalMapper.deleteQcGoalByIds(ids);
// }
// }
//
// /**
// * 删除质量目标信息
// *
// * @param id 质量目标主键
// * @return 结果
// */
// @Override
// @DS("#header.poolName")
// public int deleteQcGoalById(String id) {
// return qcGoalMapper.deleteQcGoalById(id);
// }
//
// @Override
// public List<QcGoal> buildGoalTree(List<QcGoal> qcGoals) {
// List<QcGoal> returnList = new ArrayList<>();
// List<String> tempList = qcGoals.stream().map(QcGoal::getId).collect(Collectors.toList());
// for (Iterator<QcGoal> iterator = qcGoals.iterator(); iterator.hasNext(); ) {
// QcGoal qcGoal = (QcGoal) iterator.next();
// //如果是顶级节点,遍历父节点的所有子节点
// if (!tempList.contains(qcGoal.getParentGoal())) {
// List<QcGoal> childList = getChildList(qcGoals,qcGoal);
// qcGoal.setChildren(childList);
// returnList.add(qcGoal);
// }
// }
// if (returnList.isEmpty()) {
// returnList = qcGoals;
// }
// return returnList;
// }
//
// private List<QcGoal> getChildList(List<QcGoal> list, QcGoal t) {
// List<QcGoal> tlist = new ArrayList<>();
// Iterator<QcGoal> it = list.iterator();
// while (it.hasNext()) {
// QcGoal goal = (QcGoal) it.next();
// if (goal.getParentGoal().equals(t.getId())){
// tlist.add(goal);
// }
// }
// return tlist;
// }
//
// @DS("#header.poolName")
// private String getSerialNumber(QcGoal qcGoal) {
// int liushuiNum = qcGoalMapper.getTodayMaxNum(qcGoal);
// String liushuiStr = String.format("%04d", liushuiNum);
// String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
// return dateNumber + liushuiStr;
// }
// @DS("#header.poolName")
// private String getFactoryCode() {
// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
// String key = "#header.poolName";
// return request.getHeader(key.substring(8)).replace("ds_", "");
// }
//
//}
package com.op.quality.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.vo.TreeSelect;
import com.sun.xml.bind.v2.TODO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.quality.mapper.QcGoalMapper;
import com.op.quality.domain.QcGoal;
import com.op.quality.service.IQcGoalService;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Service
*
* @author Open Platform
* @date 2024-03-04
*/
@Service
public class QcGoalServiceImpl implements IQcGoalService {
@Autowired
private QcGoalMapper qcGoalMapper;
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public QcGoal selectQcGoalById(String id) {
return qcGoalMapper.selectQcGoalById(id);
}
/**
*
*
* @param qcGoal
* @return
*/
@Override
@DS("#header.poolName")
public List<QcGoal> selectQcGoalList(QcGoal qcGoal) {
List<QcGoal> qcGoals = qcGoalMapper.selectQcGoalList(qcGoal);
for (QcGoal item : qcGoals) {
item.setHasChildren(true);
}
return qcGoals;
}
@Override
@DS("#header.poolName")
public List<QcGoal> selectChildrenByParent(QcGoal goal) {
return qcGoalMapper.selectChildrenByParent(goal);
}
@Override
@DS("#header.poolName")
public List<TreeSelect> buildQcGoalTreeSelect(List<QcGoal> qcGoals) {
List<QcGoal> qcGoalTrees = buildGoalTree(qcGoals);
return qcGoalTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
/**
*
*
* @param qcGoal
* @return
*/
@Override
@DS("#header.poolName")
public int insertQcGoal(QcGoal qcGoal) {
qcGoal.setCreateTime(DateUtils.getNowDate());
qcGoal.setCreateBy(SecurityUtils.getUsername());
qcGoal.setId(getSerialNumber(qcGoal));
qcGoal.setFactoryCode(getFactoryCode());
qcGoal.setParentGoal("0");
return qcGoalMapper.insertQcGoal(qcGoal);
}
@Override
@DS("#header.poolName")
public List<QcGoal> generate(String id) {
QcGoal goal = qcGoalMapper.selectQcGoalById(id);
List<QcGoal> genResult = new ArrayList<>();
// 提前分配大小,有助于减少不必要的计算和内存分配,从而提高代码的性能。
String goalYm = goal.getGoalYm();
BigDecimal nookQualityRate = goal.getNookQualityRate();
BigDecimal nookRate = goal.getNookRate();
String checkType = goal.getCheckType();
String typeCode = goal.getTypeCode();
String factoryCode = getFactoryCode();
String username = SecurityUtils.getUsername();
Date nowDate = DateUtils.getNowDate();
String parentGoal = goal.getId();
int liushuiNum = qcGoalMapper.getTodayMaxNum(goal);
String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
int month = 12;
for (int i = 1; i <= month; i++) {
QcGoal monthGoal = new QcGoal();
String liushuiStr = String.format("%04d", liushuiNum+i-1);
monthGoal.setId(dateNumber+liushuiStr);
String mon = String.format("%02d",i);
monthGoal.setGoalYm(goalYm+"-"+mon);
monthGoal.setGoalType("mm");
monthGoal.setNookQualityRate(nookQualityRate);
monthGoal.setNookRate(nookRate);
monthGoal.setCheckType(checkType);
monthGoal.setTypeCode(typeCode);
monthGoal.setScope(goal.getScope());
monthGoal.setCreateTime(nowDate);
monthGoal.setCreateBy(username);
monthGoal.setFactoryCode(factoryCode);
monthGoal.setParentGoal(parentGoal);
genResult.add(monthGoal);
}
// 批量插入
int flag = qcGoalMapper.insertQcGoalList(genResult);
if (flag > 0) {
return genResult;
}else {
return goal.getChildren();
}
}
/**
*
*
* @param qcGoal
* @return
*/
@Override
@DS("#header.poolName")
public int updateQcGoal(QcGoal qcGoal) {
qcGoal.setUpdateTime(DateUtils.getNowDate());
qcGoal.setUpdateBy(SecurityUtils.getUsername());
return qcGoalMapper.updateQcGoal(qcGoal);
}
/**
*
*
* @param ids
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcGoalByIds(String[] ids) {
boolean flag = false;
for (String id : ids) {
QcGoal goal = new QcGoal();
goal.setParentGoal(id);
List<QcGoal> hasChildren = qcGoalMapper.selectChildrenByParent(goal);
if (hasChildren.size() > 0) {
flag = true;
break;
}
}
if (flag) {
return 0;
}else {
return qcGoalMapper.deleteQcGoalByIds(ids);
}
}
/**
*
*
* @param id
* @return
*/
@Override
@DS("#header.poolName")
public int deleteQcGoalById(String id) {
return qcGoalMapper.deleteQcGoalById(id);
}
@Override
public List<QcGoal> buildGoalTree(List<QcGoal> qcGoals) {
List<QcGoal> returnList = new ArrayList<>();
List<String> tempList = qcGoals.stream().map(QcGoal::getId).collect(Collectors.toList());
for (Iterator<QcGoal> iterator = qcGoals.iterator(); iterator.hasNext(); ) {
QcGoal qcGoal = (QcGoal) iterator.next();
//如果是顶级节点,遍历父节点的所有子节点
if (!tempList.contains(qcGoal.getParentGoal())) {
List<QcGoal> childList = getChildList(qcGoals,qcGoal);
qcGoal.setChildren(childList);
returnList.add(qcGoal);
}
}
if (returnList.isEmpty()) {
returnList = qcGoals;
}
return returnList;
}
private List<QcGoal> getChildList(List<QcGoal> list, QcGoal t) {
List<QcGoal> tlist = new ArrayList<>();
Iterator<QcGoal> it = list.iterator();
while (it.hasNext()) {
QcGoal goal = (QcGoal) it.next();
if (goal.getParentGoal().equals(t.getId())){
tlist.add(goal);
}
}
return tlist;
}
@DS("#header.poolName")
private String getSerialNumber(QcGoal qcGoal) {
int liushuiNum = qcGoalMapper.getTodayMaxNum(qcGoal);
String liushuiStr = String.format("%04d", liushuiNum);
String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());
return dateNumber + liushuiStr;
}
@DS("#header.poolName")
private String getFactoryCode() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
return request.getHeader(key.substring(8)).replace("ds_", "");
}
}

@ -160,6 +160,7 @@
left join qc_check_project qcp on qcp.id = qctp.project_id
left join qc_project_type qpt on qpt.project_type_code = qcp.project_type
where td.belong_to = #{recordId}
order by qctp.sort
</select>
<select id="getTopInfo" resultType="com.op.quality.domain.QcCheckTaskProduce">
select t.*,be.equipment_name lineName from(

@ -151,6 +151,7 @@
from qc_check_task_detail td
left join qc_check_type_project qctp on td.type_project_id = qctp.id
where td.belong_to = #{belongTo} and td.del_flag='0' and qctp.del_flag = '0' and td.rule_name is not null
order by qctp.sort
</select>
<select id="getQcUnitList" resultType="com.op.system.api.domain.SysDictData">
select dict_label dictLabel,
@ -440,6 +441,13 @@
and check_status = '0'
</select>
<select id="getCheckLocList" resultType="com.op.quality.domain.QcDefectType">
select equipment_code defectCode,
equipment_name defectSubclass
from base_equipment
where equipment_type_code='equ_type_bzx' and status = '1'
</select>
<!--批量更新原始表-->
<update id="updateIncomeBatchList">
<foreach collection="list" item="item" separator=";">
@ -451,4 +459,6 @@
record_id = #{item}
</foreach>
</update>
</mapper>

@ -110,7 +110,8 @@
<if test="checkNo != null and checkNo != ''">and qct.check_no = #{checkNo}</if>
<if test="incomeBatchNo != null and incomeBatchNo != ''">and qct.income_batch_no = #{incomeBatchNo}</if>
<if test="orderNo != null and orderNo != ''">and qct.order_no = #{orderNo}</if>
<if test="materialCode != null and materialCode != ''">and qct.material_code = #{materialCode}</if>
<if test="materialCode != null and materialCode != ''">and qct.material_code like concat('%',
#{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''">and qct.material_name like concat('%',
#{materialName}, '%')
</if>

@ -214,5 +214,37 @@
</if>
</select>
<select id="getProductUndo" parameterType="QcGoalDistribute" resultType="QcGoalDistribute">
SELECT
bp.product_code supplierCode,
concat ( bp.product_desc_zh, '(', bp.product_code, ')' ) label
FROM
base_product bp
WHERE
bp.active_flag = '1'
AND bp.del_flag = '0'
AND bp.product_code NOT IN (
SELECT gd.supplier_code
FROM qc_goal_distribute gd
WHERE gd.belong_goal_id =#{ belongGoalId }
)
<if test="supplierName != null and supplierName != ''">and bs.zh_desc like concat('%', #{supplierName},'%')
</if>
</select>
<select id="getProductDo" parameterType="QcGoalDistribute" resultType="QcGoalDistribute">
SELECT DISTINCT
gd.supplier_code supplierCode,
concat ( bp.product_desc_zh, '(', bp.product_code, ')' ) label
FROM
qc_goal_distribute gd
LEFT JOIN base_product bp ON gd.supplier_code = bp.product_code
WHERE
gd.belong_goal_id =#{ belongGoalId}
<if test="supplierName != null and supplierName != ''">and bp.product_desc_zh like concat('%', #{supplierName},
'%')
</if>
</select>
</mapper>

@ -203,22 +203,21 @@
and CONVERT(varchar(7),feedback_time, 120) = SUBSTRING(#{ymd},0,8)
</select>
<select id="getDayNoOkHz" resultType="com.op.quality.domain.QcInterface">
SELECT
concat(t.machine_code,t.ymd) ymd,
sum(t.noOk_quality) noOkQuality,
t.machine_code machineCode
from(
select CONVERT(varchar(10),qct.income_time, 120) ymd,
qct.noOk_quality,
mrw.machine_code
from qc_check_task qct
left join pro_order_workorder pow on qct.order_no = pow.workorder_code_sap
left join mes_report_work mrw on pow.workorder_code = mrw.workorder_code
where qct.type_code = #{typeCode}
and qct.del_flag='0'
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
) t
group by t.machine_code,t.ymd
SELECT
concat(t.workorder_name,t.ymd) ymd,
sum(t.noOk_quality) noOkQuality,
t.workorder_name machineCode
from(
select CONVERT(varchar(10),qct.income_time, 120) ymd,
qct.noOk_quality,
pow.workorder_name
from qc_check_task qct
left join pro_order_workorder pow on qct.order_no = pow.workorder_code
where qct.type_code = #{typeCode}
and qct.del_flag='0'
and CONVERT(varchar(7),qct.income_time, 120) = SUBSTRING(#{ymd},0,8)
) t
group by t.workorder_name,t.ymd
</select>
<select id="getMothNoOkNum" resultType="com.op.quality.domain.QcInterface">
select

@ -269,6 +269,7 @@
<if test='checkType=="checkTypeSCXJ" or checkType=="checkTypeSC"'>
and pow.del_flag = '0'
</if>
<if test="checkLoc != null and checkLoc != ''">and qct.check_loc = #{checkLoc}</if>
<if test="checkType != null and checkType != ''">and qct.check_type = #{checkType}</if>
<if test="checkManCode != null and checkManCode != ''">and qctu.check_man_code = #{checkManCode}</if>
<if test="checkStatus != null and checkStatus != ''">and qct.check_status in (${checkStatus})</if>

@ -235,6 +235,71 @@ public class WmsToWCSmissionController {
public AjaxResult WmsProductPutByWorkOrderConfirm(@RequestBody WmsProductPut wmsProductPut) {
return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderConfirm(wmsProductPut));
}
/**
*
*
*/
@PostMapping("/addSnCorrelationBarcode")
public AjaxResult addSnCorrelationBarcode(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) {
return AjaxResult.success(wmsProductPutService.addSnCorrelationBarcode(wmsProductPutTrayCode));
}
/**
*
*
*/
@PostMapping("/deletSnCorrelationBarcode")
public AjaxResult deletSnCorrelationBarcode(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) {
return AjaxResult.success(wmsProductPutService.deletSnCorrelationBarcode(wmsProductPutTrayCode));
}
/**
*
*
*/
@PostMapping("/selectSnCorrelationBarcode")
public AjaxResult selectSnCorrelationBarcode(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) {
return AjaxResult.success(wmsProductPutService.selectSnCorrelationBarcode(wmsProductPutTrayCode));
}
/**
* --
*
*/
@PostMapping("/selectFinishedProductSales")
public AjaxResult selectFinishedProductSales(@RequestBody WmsSellOutEmbryo wmsSellOutEmbryo) {
return AjaxResult.success(wmsProductPutService.selectFinishedProductSales(wmsSellOutEmbryo));
}
/**
* --
*
*/
@PostMapping("/confirmFinishedProductSales")
public AjaxResult confirmFinishedProductSales(@RequestBody WmsSellOutEmbryo wmsSellOutEmbryo) {
return AjaxResult.success(wmsProductPutService.confirmFinishedProductSales(wmsSellOutEmbryo));
}
/**
* ----
*
*/
@PostMapping("/ScanCodeWholePallet")
public AjaxResult ScanCodeWholePallet(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) {
return AjaxResult.success(wmsProductPutService.ScanCodeWholePallet(wmsProductPutTrayCode));
}
/**
* ----
*
*/
@PostMapping("/ScanCodeSingleBox")
public AjaxResult ScanCodeSingleBox(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) {
return AjaxResult.success(wmsProductPutService.ScanCodeSingleBox(wmsProductPutTrayCode));
}
/**
*
*/
@ -301,4 +366,26 @@ public class WmsToWCSmissionController {
String result= iOdsWhiteEmbryoService.WhiteWarehouseDump(wmsOdsEmStorageNewsSn);
return success(result);
}
@PostMapping("/queryMaterialInfor")
public AjaxResult queryMaterialInfor(@RequestBody WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn) {
// OdsProcureOutOrder orderList = odsProcureOrderService.PurchaseOrderOutboundPda(odsProcureOrder);
WmsOdsEmStorageNews wmsOdsEmStorageNews= iOdsWhiteEmbryoService.queryMaterialInfor(wmsOdsEmStorageNewsSn);
return success(wmsOdsEmStorageNews);
}
/**
* 退-
*
* @param wmsOdsEmStorageNewsSn
* @return
*/
@PostMapping("/WhiteBilletReturnConfir")
public AjaxResult WhiteBilletReturnConfir(@RequestBody WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn) {
// OdsProcureOutOrder orderList = odsProcureOrderService.PurchaseOrderOutboundPda(odsProcureOrder);
String result= iOdsWhiteEmbryoService.WhiteBilletReturnConfir(wmsOdsEmStorageNewsSn);
return success(result);
}
}

@ -346,6 +346,16 @@ public class BaseEquipment extends BaseEntity {
@Excel(name = "计量单位")
private String unitMeasurement;
//新增SAP字段
/**
* SAP线
*/
private String sapCode;
/**
* SAP线
*/
private String sapName;
private String imageFileList;
private String barCodeFileList;
@ -1134,6 +1144,22 @@ public class BaseEquipment extends BaseEntity {
return unitMeasurement;
}
//SAP线体编码
public void setSapCode(String sapCode) {
this.sapCode = sapCode;
}
public String getSapCode() {
return sapCode;
}
//SAP线体名称
public void setSapName(String sapName) {
this.sapName = sapName;
}
public String getSapName() {
return sapName;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

@ -32,6 +32,20 @@ public class WmsProductPutTrayCode extends BaseEntity {
@Excel(name = "箱码")
private String barcode;
/**
*
*/
@Excel(name = "库位")
private String wlCode;
public String getWlCode() {
return wlCode;
}
public void setWlCode(String wlCode) {
this.wlCode = wlCode;
}
/**
*
*/
@ -43,6 +57,16 @@ public class WmsProductPutTrayCode extends BaseEntity {
*/
@Excel(name = "关联状态")
private String relatStatus;
@Excel(name = "工厂")
private String siteCode;
public String getSiteCode() {
return siteCode;
}
public void setSiteCode(String siteCode) {
this.siteCode = siteCode;
}
/**
* 1

@ -63,4 +63,6 @@ public interface WmsOdsEmStorageNewsMapper {
void updateAdd(WmsOdsEmStorageNews wmsOdsEmStorageNews);
WmsOdsEmStorageNews selectWmsOdsEmStorageNewsByWlCode(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn);
List<WmsOdsEmStorageNews> selectWmsOdsEmStorageNewsByMaterialCode(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn);
}

@ -4,6 +4,7 @@ import java.util.List;
import com.op.wms.domain.OdsProcureOutOrder;
import com.op.wms.domain.OdsWhiteEmbryo;
import com.op.wms.domain.WmsOdsEmStorageNews;
import com.op.wms.domain.WmsOdsEmStorageNewsSn;
/**
@ -68,4 +69,13 @@ public interface IOdsWhiteEmbryoService {
String WhiteEmbryoOutbound(OdsWhiteEmbryo odsWhiteEmbryo);
String WhiteWarehouseDump(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn);
/**
*
* @param wmsOdsEmStorageNewsSn
* @return
*/
String WhiteBilletReturnConfir(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn);
WmsOdsEmStorageNews queryMaterialInfor(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn);
}

@ -4,9 +4,7 @@ import java.text.ParseException;
import java.util.List;
import com.op.system.api.domain.wms.wmsReportWork;
import com.op.wms.domain.ProOrderWorkorder;
import com.op.wms.domain.WmsOdsWhiteEmbryoIn;
import com.op.wms.domain.WmsProductPut;
import com.op.wms.domain.*;
/**
* Service
@ -82,4 +80,24 @@ public interface IWmsProductPutService {
ProOrderWorkorder selectWmsOdsWhiteEmbryoInhAnd(WmsOdsWhiteEmbryoIn wmsOdsWhiteEmbryoIns);
String addtWmsOdsWhiteEmbryoInhAnd(WmsOdsWhiteEmbryoIn wmsOdsWhiteEmbryoIn);
List<WmsProductPutTrayCode> selectSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode);
String addSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode);
String deletSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode);
List<WmsSellOutEmbryo> selectFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo);
String confirmFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo);
/**
* ----
*
*/
List<WmsProductPutTrayCode> ScanCodeWholePallet(WmsProductPutTrayCode wmsProductPutTrayCode);
/**
* ----
*
*/
WmsProductPutTrayCode ScanCodeSingleBox(WmsProductPutTrayCode wmsProductPutTrayCode);
}

@ -265,4 +265,55 @@ public class OdsWhiteEmbryoServiceImpl implements IOdsWhiteEmbryoService {
}
return result;
}
@Override
public String WhiteBilletReturnConfir(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn) {
DynamicDataSourceContextHolder.push("ds_" + wmsOdsEmStorageNewsSn.getFactoryCode());
//退货的--在生产线上退下来的--托盘号,库位,物料号,物料描述,退货数量
String result="成功";
WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn1=new WmsOdsEmStorageNewsSn();
wmsOdsEmStorageNewsSn1.setAmount(wmsOdsEmStorageNewsSn.getAmount());
wmsOdsEmStorageNewsSn1.setWlCode(wmsOdsEmStorageNewsSn.getWlCode());
wmsOdsEmStorageNewsSn1.setMaterialCode(wmsOdsEmStorageNewsSn.getMaterialCode());
wmsOdsEmStorageNewsSn1.setMaterialDesc(wmsOdsEmStorageNewsSn.getMaterialDesc());
wmsOdsEmStorageNewsSn1.setSn(wmsOdsEmStorageNewsSn.getSn());
wmsOdsEmStorageNewsSn1.setCreateBy(wmsOdsEmStorageNewsSn.getCreateBy());
wmsOdsEmStorageNewsSn1.setGmtCreate(new Date());
wmsOdsEmStorageNewsSn1.setActiveFlag("1");
wmsOdsEmStorageNewsSn1.setFactoryCode(wmsOdsEmStorageNewsSn.getFactoryCode());
wmsOdsEmStorageNewsSnMapper.insertWmsOdsEmStorageNewsSn(wmsOdsEmStorageNewsSn1);
WmsOdsEmStorageNews wmsOdsEmStorageNews1=new WmsOdsEmStorageNews();
wmsOdsEmStorageNews1.setWlCode(wmsOdsEmStorageNewsSn.gettOwlCode());
wmsOdsEmStorageNews1.setMaterialCode(wmsOdsEmStorageNewsSn.getMaterialCode());
wmsOdsEmStorageNews1.setMaterialDesc(wmsOdsEmStorageNewsSn.getMaterialDesc());
wmsOdsEmStorageNews1.setUserDefined1(wmsOdsEmStorageNewsSn.getUserDefined1());
wmsOdsEmStorageNews1.setFactoryCode(wmsOdsEmStorageNewsSn.getFactoryCode());
wmsOdsEmStorageNews1.setActiveFlag("1");
List<WmsOdsEmStorageNews> wmsOdsEmStorageNewsList= wmsOdsEmStorageNewsMapper.selectWmsOdsEmStorageNewsList(wmsOdsEmStorageNews1);
if (wmsOdsEmStorageNewsList.size()>0){
WmsOdsEmStorageNews wmsOdsEmStorageNews2= wmsOdsEmStorageNewsList.get(0);
BigDecimal newAmount= wmsOdsEmStorageNews2.getAmount();
wmsOdsEmStorageNews2.setAmount(newAmount.add(wmsOdsEmStorageNewsSn.getAmount()));
wmsOdsEmStorageNewsMapper.updateWmsOdsEmStorageNews(wmsOdsEmStorageNews2);
}else {
wmsOdsEmStorageNews1.setStorageId(IdUtils.fastSimpleUUID());
wmsOdsEmStorageNews1.setCreateBy(wmsOdsEmStorageNewsSn.getCreateBy());
wmsOdsEmStorageNews1.setGmtCreate(new Date());
wmsOdsEmStorageNewsMapper.insertWmsOdsEmStorageNews(wmsOdsEmStorageNews1);
}
return result;
}
@Override
public WmsOdsEmStorageNews queryMaterialInfor(WmsOdsEmStorageNewsSn wmsOdsEmStorageNewsSn) {
DynamicDataSourceContextHolder.push("ds_" + wmsOdsEmStorageNewsSn.getFactoryCode());
WmsOdsEmStorageNews wmsOdsEmStorageNew=new WmsOdsEmStorageNews();
List<WmsOdsEmStorageNews> wmsOdsEmStorageNews= wmsOdsEmStorageNewsMapper.selectWmsOdsEmStorageNewsByMaterialCode(wmsOdsEmStorageNewsSn);
if (wmsOdsEmStorageNews.size()>0){
wmsOdsEmStorageNew=wmsOdsEmStorageNews.get(0);
}
return wmsOdsEmStorageNew;
}
}

@ -56,6 +56,9 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
private WmsOdsEmStorageNewsSnMapper wmsOdsEmStorageNewsSnMapper;
@Autowired
private WmsOdsEmStorageNewsMapper wmsOdsEmStorageNewsMapper;
@Autowired
private WmsProductPutTrayCodeMapper wmsProductPutTrayCodeMapper;
/**
*
*
@ -639,4 +642,85 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
return result;
}
@Override
public List<WmsProductPutTrayCode> selectSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode) {
DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode());
wmsProductPutTrayCode.setRelatStatus("1");
List<WmsProductPutTrayCode> wmsProductPutTrayCodeList= wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeList(wmsProductPutTrayCode);
return wmsProductPutTrayCodeList;
}
@Override
public String addSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode) {
String result="关联成功";
DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode());
wmsProductPutTrayCode.setRelatStatus("1");
wmsProductPutTrayCode.setStorageId(IdUtils.fastSimpleUUID());
wmsProductPutTrayCode.setNumber(1);
wmsProductPutTrayCodeMapper.insertWmsProductPutTrayCode(wmsProductPutTrayCode);
return result;
}
@Override
public String deletSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode) {
String result="解除成功";
DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode());
wmsProductPutTrayCodeMapper.deleteWmsProductPutTrayCodeByStorageId(wmsProductPutTrayCode.getStorageId());
return result;
}
@Override
public List<WmsSellOutEmbryo> selectFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo) {
return null;
}
@Override
public String confirmFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo) {
return null;
}
@Override
public List<WmsProductPutTrayCode> ScanCodeWholePallet(WmsProductPutTrayCode wmsProductPutTrayCode) {
DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode());
wmsProductPutTrayCode.setRelatStatus("1");
List<WmsProductPutTrayCode> wmsProductPutTrayCodeList= wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeList(wmsProductPutTrayCode);//sn
WmsFpStorageNewsSn wmsFpStorageNewsSn=new WmsFpStorageNewsSn();
wmsFpStorageNewsSn.setSn(wmsProductPutTrayCode.getSn());
wmsFpStorageNewsSn.setActiveFlag("1");
List<WmsFpStorageNewsSn> wmsFpStorageNewsSns= wmsFpStorageNewsSnMapper.selectWmsFpStorageNewsSnList(wmsFpStorageNewsSn);
if (wmsFpStorageNewsSns.size()>0){
WmsFpStorageNewsSn wmsFpStorageNewsSn1= wmsFpStorageNewsSns.get(0);
for (WmsProductPutTrayCode wmsProductPutTrayCode1:
wmsProductPutTrayCodeList) {
wmsProductPutTrayCode1.setWlCode(wmsFpStorageNewsSn1.getWlCode());
}
}
return wmsProductPutTrayCodeList;
}
@Override
public WmsProductPutTrayCode ScanCodeSingleBox(WmsProductPutTrayCode wmsProductPutTrayCode) {
DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode());
wmsProductPutTrayCode.setRelatStatus("1");
//barcode
List<WmsProductPutTrayCode> wmsProductPutTrayCodeList= wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeList(wmsProductPutTrayCode);
//对应的箱码
if (wmsProductPutTrayCodeList.size()>0){
WmsProductPutTrayCode wmsProductPutTrayCode1= wmsProductPutTrayCodeList.get(0);
wmsProductPutTrayCode.setSn(wmsProductPutTrayCode1.getSn());//托盘
WmsFpStorageNewsSn wmsFpStorageNewsSn=new WmsFpStorageNewsSn();
wmsFpStorageNewsSn.setSn(wmsProductPutTrayCode.getSn());
wmsFpStorageNewsSn.setActiveFlag("1");
List<WmsFpStorageNewsSn> wmsFpStorageNewsSns= wmsFpStorageNewsSnMapper.selectWmsFpStorageNewsSnList(wmsFpStorageNewsSn);
//库位
if(wmsFpStorageNewsSns.size()>0){
WmsFpStorageNewsSn wmsFpStorageNewsSn1= wmsFpStorageNewsSns.get(0);
wmsProductPutTrayCode.setWlCode( wmsFpStorageNewsSn1.getWlCode());//库位
return wmsProductPutTrayCode;
}
}
return null;
}
}

@ -54,7 +54,8 @@
<result property="equipmentNumber" column="equipment_number"/>
<result property="inventoryNumber" column="inventory_number"/>
<result property="unitMeasurement" column="unit_measurement"/>
<result property="sapCode" column="sap_code"/>
<result property="sapName" column="sap_name"/>
</resultMap>
<resultMap type="WmsSparePartsLedger" id="WmsSparePartsLedgerResult">
@ -175,7 +176,9 @@
asset_description,
equipment_number,
inventory_number,
unit_measurement
unit_measurement,
sap_code,
sap_name
from base_equipment
</sql>
@ -251,6 +254,8 @@
<if test="equipmentNumber != null and equipmentNumber != ''">and equipment_number = #{equipmentNumber}</if>
<if test="inventoryNumber != null and inventoryNumber != ''">and inventory_number = #{inventoryNumber}</if>
<if test="unitMeasurement != null and unitMeasurement != ''">and unit_measurement = #{unitMeasurement}</if>
<if test="sapCode != null and sapCode != ''">and sap_code = #{sapCode}</if>
<if test="sapName != null and sapName != ''">and sap_name = #{sapName}</if>
and del_flag ='0'
</where>
</select>
@ -318,6 +323,8 @@
<if test="equipmentNumber != null">equipment_number,</if>
<if test="inventoryNumber != null">inventory_number,</if>
<if test="unitMeasurement != null">unit_measurement,</if>
<if test="sapCode != null">sap_code,</if>
<if test="sapName != null">sap_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="equipmentCode != null and equipmentCode != ''">#{equipmentCode},</if>
@ -368,6 +375,8 @@
<if test="equipmentNumber != null and equipmentNumber != ''">#{equipmentNumber},</if>
<if test="inventoryNumber != null and inventoryNumber != ''">#{inventoryNumber},</if>
<if test="unitMeasurement != null and unitMeasurement != ''">#{unitMeasurement},</if>
<if test="sapCode != null and sapCode != ''">#{sapCode},</if>
<if test="sapName != null and sapName != ''">#{sapName},</if>
</trim>
</insert>
@ -427,6 +436,8 @@
<if test="equipmentNumber != null and equipmentNumber != ''">equipment_number = #{equipmentNumber},</if>
<if test="inventoryNumber != null and inventoryNumber != ''">inventory_number = #{inventoryNumber},</if>
<if test="unitMeasurement != null and unitMeasurement != ''">unit_measurement = #{unitMeasurement},</if>
<if test="sapCode != null and sapCode != ''">sap_code = #{sapCode},</if>
<if test="sapName != null and sapName != ''">sap_name = #{sapName},</if>
</trim>
where equipment_id = #{equipmentId}
</update>

@ -41,8 +41,43 @@
</resultMap>
<sql id="selectWmsOdsEmStorageNewsVo">
select storage_id, wh_code, region_code, wa_code, storage_type, wl_code, material_code, material_desc, amount, storage_amount, occupy_amount, lpn, product_batch, receive_date, product_date, user_defined1, user_defined2, user_defined3, user_defined4, user_defined5, user_defined6, user_defined7, user_defined8, user_defined9, user_defined10, create_by, gmt_create, last_modified_by, gmt_modified, active_flag, factory_code, sap_factory_code, wl_name from wms_ods_em_storage_news
</sql>
SELECT
storage_id,
wh_code,
region_code,
wa_code,
storage_type,
wl_code,
material_code,
material_desc,
COALESCE(amount, 0) as amount,
storage_amount,
occupy_amount,
lpn,
product_batch,
receive_date,
product_date,
user_defined1,
user_defined2,
user_defined3,
user_defined4,
user_defined5,
user_defined6,
user_defined7,
user_defined8,
user_defined9,
user_defined10,
create_by,
gmt_create,
last_modified_by,
gmt_modified,
active_flag,
factory_code,
sap_factory_code,
wl_name
FROM
wms_ods_em_storage_news
</sql>
<select id="selectWmsOdsEmStorageNewsList" parameterType="WmsOdsEmStorageNews"
resultMap="WmsOdsEmStorageNewsResult">
@ -222,4 +257,14 @@
<include refid="selectWmsOdsEmStorageNewsVo"/>
WHERE wl_code=#{wlCode} AND material_code=#{materialCode} AND active_flag='1'
</select>
<select id="selectWmsOdsEmStorageNewsByMaterialCode" resultMap="WmsOdsEmStorageNewsResult">
SELECT
DISTINCT
material_code,
material_desc,
user_defined1
FROM
wms_ods_em_storage_news
WHERE material_code=#{materialCode} AND active_flag='1'
</select>
</mapper>

Loading…
Cancel
Save