Merge remote-tracking branch 'origin/master'

# Conflicts:
#	op-modules/op-sap/src/main/java/com/op/sap/service/impl/SapItemSyncImpl.java
master
Yangwl 10 months ago
commit ef5954f39a

@ -60,6 +60,98 @@ public class HRInfo extends BaseEntity {
/** 角色ID */
private Long roleId;
private String datasourceId;
private String post;
/**hr接口**/
private String peWorkID;//工号
private String peName;//员工姓名
private String peSex;//性别 F女生 M男
private String peMobilePhone;//手机号
//派驻1 人才库-1 试用10 实习11 见习期19 正式工20 离职30 自离31 辞退32 开除33 删除99
private String peDocStatus;
private String posnm;//岗位名称
private String poscd;//岗位编码
private String ounam;//部门名称
private String oucod;//部门编码
public String getPeWorkID() {
return peWorkID;
}
public void setPeWorkID(String peWorkID) {
this.peWorkID = peWorkID;
}
public String getPeName() {
return peName;
}
public void setPeName(String peName) {
this.peName = peName;
}
public String getPeSex() {
return peSex;
}
public void setPeSex(String peSex) {
this.peSex = peSex;
}
public String getPeMobilePhone() {
return peMobilePhone;
}
public void setPeMobilePhone(String peMobilePhone) {
this.peMobilePhone = peMobilePhone;
}
public String getPeDocStatus() {
return peDocStatus;
}
public void setPeDocStatus(String peDocStatus) {
this.peDocStatus = peDocStatus;
}
public String getPosnm() {
return posnm;
}
public void setPosnm(String posnm) {
this.posnm = posnm;
}
public String getPoscd() {
return poscd;
}
public void setPoscd(String poscd) {
this.poscd = poscd;
}
public String getOunam() {
return ounam;
}
public void setOunam(String ounam) {
this.ounam = ounam;
}
public String getOucod() {
return oucod;
}
public void setOucod(String oucod) {
this.oucod = oucod;
}
public String getPost() {
return post;
}
public void setPost(String post) {
this.post = post;
}
public String getDatasourceId() {
return datasourceId;

@ -168,17 +168,13 @@ public class RyTask {
logger.info("++hr人力基础数据同步+开始++syncUserInfoTask+++++");
remoteUserService.syncUserInfoTask();
}
/************hr 人力基础数据定时任务结束*****************/
/************岗位基础数据定时任务开始*****************/
//岗位基本数据同步每天
public void sysPostInfoTask(){
logger.info("++hr岗位基础数据同步+开始++sysPostInfoTask+++++");
remoteUserService.sysPostInfoTask();
}
/************岗位基础数据定时任务开始*****************/
/************部门基础数据定时任务开始*****************/
//部门基本数据同步每天
public void sysDeptInfoTask(){
logger.info("++hr部门基础数据同步+开始++sysPostInfoTask+++++");

@ -111,6 +111,15 @@ public class MesReportWorkConsume extends BaseEntity {
private String warehouseCode;
private String warehouseName;
private String planQuantity;
public String getPlanQuantity() {
return planQuantity;
}
public void setPlanQuantity(String planQuantity) {
this.planQuantity = planQuantity;
}
public String getWarehouseCode() {
return warehouseCode;

@ -451,7 +451,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
mapBom = new HashMap<String, Object>();
mapBom.put("P_AUFNR",updateBom.getWorkorderCodeSap());// 订单号 例如000100308287
mapBom.put("P_MATNR",updateBom.getMaterialCode());// 物料号 例如000000040000015089
mapBom.put("P_GMEIN",updateBom.getUnit());// 基本计量单位 例如m
//mapBom.put("P_GMEIN",updateBom.getUnit());// 基本计量单位 例如m
mapBom.put("P_WERKS",workOrderCodes.get(0).getFactoryCode());//物料工厂 例如1000
mapBom.put("P_LGORT",updateBom.getWarehouseCode());//仓库编号 例如0013
mapList.add(mapBom);

@ -104,10 +104,13 @@
mrwc.recoil,
pow.workorder_code_sap workorderCodeSap,
mrwc.attr1,
mrwc.warehouse_code warehouseCode
mrwc.warehouse_code warehouseCode,
mpd.quantity planQuantity
from mes_report_work_consume mrwc
left join pro_order_workorder pow on mrwc.workorder_code = pow.workorder_code
where mrwc.del_flag = '0' and pow.del_flag = '0'
left join mes_prepare_detail mpd on mpd.parent_work_order = pow.belong_work_order
and mpd.material_code = mrwc.material_code
where mrwc.del_flag = '0' and pow.del_flag = '0' and mpd.del_flag = '0'
and mrwc.workorder_code = #{workorderCode}
order by mrwc.recoil,mrwc.attr1
</select>

@ -77,7 +77,7 @@ public interface OpenMapper {
public int addBatch(@Param("list") List<QcCheckTaskDetailDTO> items);
List<QcUserMaterialDTO> getCheckUsers(String materialCode);
List<QcUserMaterialDTO> getCheckUsers(String checkType);
public int addCheckUsers(@Param("list") List<QcUserMaterialDTO> users);
}

@ -346,7 +346,7 @@ public class OpenServiceImpl implements OpenService {
qctp.setMaterialCode(qcCheckTaskProduce.getMaterialCode());//特性
/**qc_user_material取默认检查人**/
List<QcUserMaterialDTO> users = openMapper.getCheckUsers(qcCheckTaskProduce.getOrderNo());
List<QcUserMaterialDTO> users = openMapper.getCheckUsers(qcCheckTaskProduce.getCheckType());
if (CollectionUtils.isEmpty(users)) {
QcUserMaterialDTO dto0 = new QcUserMaterialDTO();
dto0.setId(IdUtils.fastSimpleUUID());
@ -474,9 +474,10 @@ public class OpenServiceImpl implements OpenService {
public AjaxResult GetHrUserInfo(String dateTime) {
try {
StringBuilder postDataBuilder = new StringBuilder();
postDataBuilder.append("createTime=").append("dateTime");
postDataBuilder.append("createTime=").append(dateTime);
String result = HttpUtils.sendPost(url_user,postDataBuilder.toString());
return success(result);
JSONArray jsonArray=JSONArray.parseArray(result);
return success("获取成功",jsonArray);
} catch (Exception e) {
e.printStackTrace();
return error(e.getMessage());

@ -199,8 +199,7 @@
select qum.user_code userCode,
qum.user_name userName
from qc_user_material qum
left join pro_order_workorder pow on pow.workorder_code = qum.material_code
where pow.workorder_code = #{workorderCode} and pow.del_flag = '0' and qum.del_flag = '0'
where qum.material_code = #{checkType} and pow.del_flag = '0' and qum.del_flag = '0'
</select>
<insert id="insertEquRepairOrder" parameterType="DeviceRepairOrder">

@ -153,6 +153,13 @@ public class ProOrderController extends BaseController {
return proOrderService.subSplitOrder(splitOrderDTO);
}
@PostMapping("/checkRepeatBatchCodes")
//@RequiresPermissions("mes:pro:order:add")
@Log(title = "提交拆分订单-批次重复确认", businessType = BusinessType.INSERT)
public String checkRepeatBatchCodes(@RequestBody SplitOrderDTO splitOrderDTO) {
return proOrderService.checkRepeatBatchCodes(splitOrderDTO);
}
/**
*
*

@ -1,5 +1,6 @@
package com.op.plan.mapper;
import com.op.plan.domain.Batch;
import com.op.plan.domain.ProOrder;
import com.op.plan.domain.ProOrderWorkorder;
import com.op.plan.domain.ProWetMaterialPlanDetail;
@ -194,5 +195,7 @@ public interface ProOrderWorkorderMapper {
List<String> getOrderNotW0(@Param("workorderCodes") String[] workorderCodes);
List<ProOrderWorkorder> getOrderByOrders(@Param("orderIds") String[] orderIds);
List<String> checkBatchCodes(@Param("batchs") List<Batch> formFields);
}

@ -143,4 +143,6 @@ public interface IProOrderService {
int getProSortNo(ProOrder proOrder);
int deleteOrder(String[] orderCodes);
String checkRepeatBatchCodes(SplitOrderDTO splitOrderDTO);
}

@ -1171,6 +1171,15 @@ public class ProOrderServiceImpl implements IProOrderService {
}
return 1;
}
@Override
@DS("#header.poolName")
public String checkRepeatBatchCodes(SplitOrderDTO splitOrderDTO) {
List<String> repeatBatchCodes = proOrderWorkorderMapper.checkBatchCodes(splitOrderDTO.getFormFields());
if(!CollectionUtils.isEmpty(repeatBatchCodes)){
return StringUtils.join(repeatBatchCodes, ",");
}
return "";
}
public static void main(String args[]){
String arrayStr = "[[\"GX01\",\"LG1\"],[\"GX01\",\"LG2\"],[\"GX02\",\"S1\"],[\"GX02\",\"S2\"],[\"GX03\",\"HF01\"],[\"GX04\",\"SPJ01\"]]";

@ -543,6 +543,14 @@
</foreach>
and status in ('o1','o0') and del_flag = '0'
</select>
<select id="checkBatchCodes" resultType="java.lang.String">
select distinct batch_code
from pro_order_workorder_batch
where del_flag='1' and batch_code in
<foreach item="batch" collection="batchs" open="(" separator="," close=")">
#{batch.batchCode}
</foreach>
</select>
<insert id="createPrepareDetails">
insert into mes_prepare_detail

@ -21,10 +21,13 @@ import com.op.common.core.utils.bean.BeanUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.system.api.RemoteOpenService;
import com.op.system.api.RemoteSapService;
import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysRole;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.quality.HRInfo;
import com.op.system.api.domain.quality.QcCheckTaskIncomeDTO;
import com.op.system.api.domain.sap.SapSupplier;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
@ -62,6 +65,9 @@ public class QcCheckTaskIncomeController extends BaseController {
@Autowired
private RemoteUserService remoteUserService;
@Autowired
private RemoteSapService remoteSapService;
/**
*
*/
@ -156,10 +162,15 @@ public class QcCheckTaskIncomeController extends BaseController {
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
try {
dateSources.forEach(dateSource -> {
Runnable run = () -> createIncomeBatchTaskFunc(dateSource.get("poolName"));
executorService.execute(run);
if(!"ds_999".equals(dateSource.get("poolName"))){
Runnable run = () -> createIncomeBatchTaskFunc(dateSource.get("poolName"));
executorService.execute(run);
}
});
} catch (Exception e) {
logger.error("controller == createIncomeBatchTask == exception", e);
return error("controller == createIncomeBatchTask == exception");
@ -174,32 +185,39 @@ public class QcCheckTaskIncomeController extends BaseController {
DynamicDataSourceContextHolder.push(poolName);// 这是数据源的key
Date taskTime = DateUtils.getNowDate();
logger.info("++++++++++++" + poolName + "工厂来料检验批量创建任务开始+++时间:"+ taskTime +"++++++++++");
List<QcCheckTaskIncome> incomeBatchLists = qcCheckTaskIncomeService.getIncomeBatchList(poolName);
List<String> batchRecordIds = new ArrayList<>();
Map<String, Object> mapBom = new HashMap<String, Object>();
mapBom.put("P_WERKS",poolName.replace("ds_",""));//物料工厂 例如1000
logger.info("来料信息查询请求:" + JSONObject.toJSONString(mapBom));
R incomeR = remoteSapService.inComingCheck(mapBom);
if(incomeR.getCode()==500){
logger.info("来料信息查询请求:" + JSONObject.toJSONString(incomeR));
return AjaxResult.error(JSONObject.toJSONString(incomeR));
}
logger.info("来料信息查询结果:" + JSONObject.toJSONString(incomeR));
List<QcCheckTaskIncomeDTO> incomeAll = (List<QcCheckTaskIncomeDTO>)incomeR.getData();
//已经生成过检验任务的采购订单
List<String> todayIncomeLists = qcCheckTaskIncomeService.getTodayIncomeLists();
List<QcCheckTaskIncomeDTO> newIncomes = incomeAll.stream()
.filter(item -> !todayIncomeLists.contains(item.getOrderNo()))
.collect(Collectors.toList());
int successNum = 0;//成功任务数
int failNum = 0;//失败任务数
if(incomeBatchLists != null){
for( int i = 0 ; i < incomeBatchLists.size();){
QcCheckTaskIncomeDTO qcCheckTaskIncomedto = new QcCheckTaskIncomeDTO();
QcCheckTaskIncome income = incomeBatchLists.get(i);
BeanUtils.copyProperties(income,qcCheckTaskIncomedto);
//内层一个一个创建任务
AjaxResult ajaxResult = createIncomeTask(qcCheckTaskIncomedto);
if(!CollectionUtils.isEmpty(newIncomes)){
logger.info("工厂来料检验任务生成参数:" + JSONObject.toJSONString(newIncomes));
for(QcCheckTaskIncomeDTO income:newIncomes){
AjaxResult ajaxResult = createIncomeTask(income);
if(ajaxResult.isSuccess()){
batchRecordIds.add(qcCheckTaskIncomedto.getRecordId());
successNum = successNum + 1;
logger.info(poolName + "工厂的" + income.getCheckNo()+"来料检验创建任务成功++++++++++");
}else if(ajaxResult.isError()){
failNum = failNum +1;
logger.info(poolName + "工厂的" + income.getCheckNo()+"来料检验创建任务失败++++++++++");
}
i++;
}
}else{
logger.info("++++++++++++" + poolName + "工厂来料检验没有可创建的任务++++++++++");
}
//批量修改原表中的check_status和check_time
int upate = qcCheckTaskIncomeService.updateIncomeBatchList(batchRecordIds,taskTime);
logger.info("++++++++++++" + poolName + "工厂来料检验批量创建任务结束:成功"+ successNum +"失败"+ failNum +"+++++");
return success();
} catch (Exception e) {
@ -209,9 +227,7 @@ public class QcCheckTaskIncomeController extends BaseController {
}
@PostMapping("/createIncomeTask")
public AjaxResult createIncomeTask(@RequestBody QcCheckTaskIncomeDTO qcCheckTaskIncome0) {
QcCheckTaskIncome qcCheckTaskIncome = new QcCheckTaskIncome();
BeanUtils.copyProperties(qcCheckTaskIncome0, qcCheckTaskIncome);
public AjaxResult createIncomeTask(@RequestBody QcCheckTaskIncomeDTO qcCheckTaskIncome) {
if (StringUtils.isBlank(qcCheckTaskIncome.getOrderNo())) {
return error("[orderNo]不能为空");
@ -222,12 +238,7 @@ public class QcCheckTaskIncomeController extends BaseController {
if (StringUtils.isBlank(qcCheckTaskIncome.getMaterialCode())) {
return error("[materialCode]不能为空");
}
if (StringUtils.isBlank(qcCheckTaskIncome.getCheckType())) {
return error("[checkType]不能为空");
}
if (StringUtils.isBlank(qcCheckTaskIncome.getFactoryCode())) {
return error("[factoryCode]不能为空");
}
if (StringUtils.isBlank(qcCheckTaskIncome.getSupplierCode())) {
return error("[supplierCode]不能为空");
}
@ -237,14 +248,13 @@ public class QcCheckTaskIncomeController extends BaseController {
if (qcCheckTaskIncome.getIncomeTime() == null) {
return error("[incomeTime]不能为空");
}
logger.info(qcCheckTaskIncome0.getFactoryCode() + "工厂来料检验任务生成开始================================");
logger.info(qcCheckTaskIncome0.getFactoryCode() + "工厂来料检验任务生成参数:" + JSONObject.toJSONString(qcCheckTaskIncome));
int r = qcCheckTaskIncomeService.insertQcCheckTaskIncome(qcCheckTaskIncome);
QcCheckTaskIncome income = new QcCheckTaskIncome();
BeanUtils.copyProperties(qcCheckTaskIncome,income);
int r = qcCheckTaskIncomeService.insertQcCheckTaskIncome(income);
if (r > 0) {
return toAjax(r);
}
return error(qcCheckTaskIncome0.getFactoryCode() + "工厂添加失败:请检查物料的关联检测项" );
return error("添加失败:请检查物料的关联检测项" );
}

@ -88,6 +88,34 @@ public class QcCheckTaskDefect extends BaseEntity {
@Excel(name = "不合格数量")
private BigDecimal noOkQuality;
private String defectCodes;
private String defectNames;
private String defectQualitys;
public String getDefectCodes() {
return defectCodes;
}
public void setDefectCodes(String defectCodes) {
this.defectCodes = defectCodes;
}
public String getDefectNames() {
return defectNames;
}
public void setDefectNames(String defectNames) {
this.defectNames = defectNames;
}
public String getDefectQualitys() {
return defectQualitys;
}
public void setDefectQualitys(String defectQualitys) {
this.defectQualitys = defectQualitys;
}
public String getBelongToDetail() {
return belongToDetail;
}

@ -95,7 +95,7 @@ public class QcCheckTaskIncome extends BaseEntity {
*/
@Excel(name = "检测地点")
private String checkLoc;
private String checkLocName;
/**
*
*/
@ -193,6 +193,14 @@ public class QcCheckTaskIncome extends BaseEntity {
private String noOkQualityNames;
private String noOkQualityVals;
public String getCheckLocName() {
return checkLocName;
}
public void setCheckLocName(String checkLocName) {
this.checkLocName = checkLocName;
}
public String getNoOkQualityNames() {
return noOkQualityNames;
}

@ -1,8 +1,11 @@
package com.op.quality.mapper;
import java.util.List;
import java.util.Map;
import com.op.quality.domain.QcCheckTaskDefect;
import com.op.quality.domain.QcCheckTaskDetail;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
/**
@ -64,6 +67,6 @@ public interface QcCheckTaskDefectMapper {
public int deleteQcCheckTaskDefectByBelongTo(String belongTo);
public List<QcCheckTaskDefect> selectDefectByBelongTo(String belongTo);
@MapKey("belongToDetail")
public Map<String, QcCheckTaskDefect> getDefectMap(QcCheckTaskDetail qcCheckTaskDetail);
}

@ -88,9 +88,7 @@ public interface QcCheckTaskIncomeMapper {
List<String> selectQcCheckTaskCheckNoByRecordIds(String[] recordIds);
List<QcUserMaterialDTO> getUserByMaterial(String materialCode);
List<QcUserMaterialDTO> getCheckUsers(String orderNo);
List<QcUserMaterialDTO> getUserByCheckType(String checkType);
int addCheckUsers(@Param("list") List<QcUserMaterialDTO> users);
@ -112,4 +110,6 @@ public interface QcCheckTaskIncomeMapper {
int updateIncomeBatchList(@Param("list") List<String> batchRecordIds, @Param("time") Date taskTime);
List<QcDefectType> getCheckLocList(QcDefectType qcDefectType);
List<String> getTodayIncomeLists();
}

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

@ -210,11 +210,11 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
}
//检验人插入
qcCheckTaskUserService.insertQcCheckTaskUserPDA(qcCheckTaskUserList);
}else{//上位机触发
}else{
qcCheckTaskIncome.setCheckManName("");
qcCheckTaskIncome.setCheckManCode("");
/**qc_user_material取默认检查人**/
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getCheckUsers(qcCheckTaskIncome.getOrderNo());
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getUserByCheckType(qcCheckTaskIncome.getCheckType());
if(CollectionUtils.isEmpty(users)){
QcUserMaterialDTO dto0 = new QcUserMaterialDTO();
dto0.setId(IdUtils.fastSimpleUUID());
@ -599,7 +599,7 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
break;
}
}
//TODO;today
int n = 0;
QcCheckTaskIncome qcCheckTask = new QcCheckTaskIncome();
qcCheckTask.setUpdateBy(updateBy);
@ -610,14 +610,9 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
qcCheckTask.setCheckResult(result);//检验结果Y合格 N不合格
qcCheckTask.setIncomeBatchNo(qcCheckTaskIncome.getIncomeBatchNo());
BigDecimal noOkQquality = new BigDecimal("0");
List<QcCheckTaskDefect> defects = qcCheckTaskIncome.getDefects();
for(QcCheckTaskDefect defect:defects){
defect.setRecordId(IdUtils.fastSimpleUUID());
defect.setCreateTime(nowTime);
defect.setCreateBy(updateBy);
defect.setFactoryCode(factoryCode);
defect.setBelongTo(belongId);
noOkQquality = noOkQquality.add(defect.getNoOkQuality());
List<QcCheckTaskDefect> defects0 = qcCheckTaskIncome.getDefects();
for(QcCheckTaskDefect defect0:defects0){
noOkQquality = noOkQquality.add(defect0.getNoOkQuality());
}
qcCheckTask.setNoOkQuality(noOkQquality);//累计不合格数
qcCheckTask.setCheckManCode(qcCheckTaskIncome.getUpdateBy());
@ -655,6 +650,28 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
/**qc_check_task_defect**/
n=qcCheckTaskIncomeMapper.deleteQcCheckTaskDefects(belongId);
logger.info("清理qc_check_task_defect:"+n);
List<QcCheckTaskDefect> defects = new ArrayList<>();
QcCheckTaskDefect defect = null;
for(QcCheckTaskDetail detail:details){
if(StringUtils.isNotBlank(detail.getDefectCodes())){
String[] defectCodes = detail.getDefectCodes().split(",");
String[] defectNames = detail.getDefectNames().split(",");
String[] defectQualitys = detail.getDefectQualitys().split(",");
for(int d=0;d<defectCodes.length;d++){
defect = new QcCheckTaskDefect();
defect.setDefectCode(defectCodes[d]);
defect.setDefectSubclass(defectNames[d].split(":")[0]);
defect.setNoOkQuality(new BigDecimal(defectQualitys[d]));
defect.setRecordId(IdUtils.fastSimpleUUID());
defect.setCreateTime(nowTime);
defect.setCreateBy(updateBy);
defect.setFactoryCode(factoryCode);
defect.setBelongTo(belongId);
defect.setBelongToDetail(detail.getRecordId());
defects.add(defect);
}
}
}
n= qcCheckTaskIncomeMapper.addQcCheckTaskDefects(defects);
logger.info("qc_check_task_defect:"+n);
@ -727,5 +744,10 @@ public class QcCheckTaskIncomeServiceImpl implements IQcCheckTaskIncomeService {
return qcCheckTaskIncomeMapper.getCheckLocList(qcDefectType);
}
@Override
public List<String> getTodayIncomeLists() {
return qcCheckTaskIncomeMapper.getTodayIncomeLists();
}
}

@ -204,7 +204,7 @@ public class QcCheckTaskProduceServiceImpl implements IQcCheckTaskProduceService
qcCheckTaskProduce.setCheckManName("");
qcCheckTaskProduce.setCheckManCode("");
/**qc_user_material取默认检查人**/
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getCheckUsers(qcCheckTaskProduce.getOrderNo());
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getUserByCheckType(qcCheckTaskProduce.getCheckType());
if(!CollectionUtils.isEmpty(users)){
for(QcUserMaterialDTO user:users){
user.setId(IdUtils.fastSimpleUUID());

@ -179,7 +179,7 @@ public class QcCheckTaskWarehousingServiceImpl implements IQcCheckTaskWarehousin
qcCheckTaskWarehousing.setCheckManName("");
qcCheckTaskWarehousing.setCheckManCode("");
/**qc_user_material取默认检查人**/
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getUserByMaterial(qcCheckTaskWarehousing.getMaterialCode());
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getUserByCheckType(qcCheckTaskWarehousing.getCheckType());
if(CollectionUtils.isEmpty(users)){
QcUserMaterialDTO dto0 = new QcUserMaterialDTO();
dto0.setUserCode("mobile");

@ -11,6 +11,7 @@ import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils;
import com.op.quality.domain.*;
import com.op.quality.mapper.QMSFileMapper;
import com.op.quality.mapper.QcCheckTaskDefectMapper;
import com.op.quality.mapper.QcCheckTaskIncomeMapper;
import com.op.quality.mapper.QcProCheckMapper;
import com.op.quality.service.QcProCheckService;
@ -37,6 +38,9 @@ public class QcProCheckServiceImpl implements QcProCheckService {
@Autowired
private QcCheckTaskIncomeMapper qcCheckTaskIncomeMapper;
@Autowired
private QcCheckTaskDefectMapper qcCheckTaskDefectMapper;
@Autowired
private QMSFileMapper qmsFileMapper;
@ -136,12 +140,21 @@ public class QcProCheckServiceImpl implements QcProCheckService {
DynamicDataSourceContextHolder.push(qcCheckTaskDetail.getFactoryCode());
QcCheckTaskIncome dto = new QcCheckTaskIncome();
List<QcCheckTaskDetail> qcCheckTaskDetails = qcCheckTaskIncomeMapper.getCkeckProjectList(qcCheckTaskDetail);
/**qc_check_task_defect**/
Map<String,QcCheckTaskDefect> defectMap = qcCheckTaskDefectMapper.getDefectMap(qcCheckTaskDetail);
for (QcCheckTaskDetail qcd : qcCheckTaskDetails) {
List<BaseFile> files = qmsFileMapper.getBaseFileBatch(qcd.getRecordId());
if (CollectionUtils.isNotEmpty(files)) {
qcd.setFiles(files);
}
QcCheckTaskDefect defectInfo = defectMap.get(qcd.getRecordId());
if(defectInfo != null){
qcd.setDefectCodes(defectInfo.getDefectCodes());
qcd.setDefectNames(defectInfo.getDefectNames());
qcd.setDefectQualitys(defectInfo.getDefectQualitys());
}
}
dto.setQcCheckTaskDetails(qcCheckTaskDetails);

@ -130,5 +130,33 @@
where belong_to = #{belongTo}
order by defect_code
</select>
<select id="getDefectMap" resultType="com.op.quality.domain.QcCheckTaskDefect">
SELECT
belong_to,
belong_to_detail belongToDetail,
STUFF(
(SELECT ',' + defect_code
FROM qc_check_task_defect
WHERE belong_to_detail = qctd.belong_to_detail and belong_to = qctd.belong_to
FOR xml path('')
),1,1,''
) defectCodes,
STUFF(
(SELECT ',' + defect_subclass+':' + CAST(noOk_quality AS VARCHAR(15))
FROM qc_check_task_defect
WHERE belong_to_detail = qctd.belong_to_detail and belong_to = qctd.belong_to
FOR xml path('')
),1,1,''
) defectNames,
STUFF(
(SELECT ',' + CAST(noOk_quality AS VARCHAR(15))
FROM qc_check_task_defect
WHERE belong_to_detail = qctd.belong_to_detail and belong_to = qctd.belong_to
FOR xml path('')
),1,1,''
) defectQualitys
FROM qc_check_task_defect qctd where qctd.del_flag = '0' and belong_to= #{belongTo}
GROUP by qctd.belong_to,qctd.belong_to_detail
</select>
</mapper>

@ -337,26 +337,21 @@
#{recordId}
</foreach>
</select>
<select id="getUserByMaterial" resultType="com.op.system.api.domain.quality.QcUserMaterialDTO">
<select id="getUserByCheckType" resultType="com.op.system.api.domain.quality.QcUserMaterialDTO">
select user_code userCode,
user_name userName
from qc_user_material where material_code = #{materialCode}
from qc_user_material
where material_code = #{checkType} and del_flag = '0'
</select>
<select id="getCheckUsers" resultType="com.op.system.api.domain.quality.QcUserMaterialDTO">
select qum.user_code userCode,
qum.user_name userName
from qc_user_material qum
left join pro_order_workorder pow on pow.workorder_code = qum.material_code
where pow.workorder_code = #{orderNo} and pow.del_flag = '0' and qum.del_flag = '0'
</select>
<select id="getCkeckDefectList" resultType="com.op.quality.domain.QcCheckTaskDefect">
select
qctd.record_id recordId,
qctd.defect_code defectCode,
qctd.defect_subclass defectSubclass,
qctd.noOk_quality noOkQuality
sum(qctd.noOk_quality) noOkQuality
from qc_check_task_defect qctd
where qctd.del_flag = '0' and qctd.belong_to = #{belongTo}
group by qctd.defect_code,qctd.defect_subclass
order by qctd.defect_code
</select>
<select id="getDefectType" resultType="com.op.quality.domain.QcCheckTaskDefect">
@ -423,14 +418,14 @@
</insert>
<insert id="addQcCheckTaskDefects">
insert into qc_check_task_defect(
record_id,belong_to,
record_id,belong_to,belong_to_detail,
defect_code,defect_subclass,
noOk_quality,
create_by,create_time,factory_code
) values
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.recordId},#{item.belongTo},
#{item.recordId},#{item.belongTo},#{item.belongToDetail},
#{item.defectCode},#{item.defectSubclass},
#{item.noOkQuality},
#{item.createBy},#{item.createTime},#{item.factoryCode}
@ -454,6 +449,12 @@
from base_equipment
where equipment_type_code='equ_type_bzx' and status = '1'
</select>
<select id="getTodayIncomeLists" resultType="java.lang.String">
select order_no
from qc_check_task
where check_type = 'checkTypeLL'
and CONVERT(varchar(10),GETDATE(), 120) = CONVERT(varchar(10),create_time, 120)
</select>
<!--批量更新原始表-->
<update id="updateIncomeBatchList">

@ -49,6 +49,7 @@
<result property="supplierName" column="supplier_name"/>
<result property="incomeTime" column="income_time"/>
<result property="checkLoc" column="check_loc"/>
<result property="checkLocName" column="checkLocName"/>
<result property="checkStatus" column="check_status"/>
<result property="checkManCode" column="check_man_code"/>
<result property="checkManName" column="check_man_name"/>
@ -252,7 +253,7 @@
<select id="getCheckTaskList" resultMap="QcCheckTaskIncomeResult">
select qct.record_id, qct.check_no, qct.income_batch_no, qct.order_no,
qct.material_code, qct.material_name, qct.quality, qct.unit,
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc,
qct.supplier_code, qct.supplier_name, qct.income_time, qct.check_loc,be.equipment_name checkLocName,
qct.check_status, qct.check_man_code,qct.check_man_name, qct.check_time, qct.check_result,
qct.status,qct.create_by,qct.create_time,qct.check_type,
qct.noOk_quality,qct.aNoOkquality,qct.bNoOkquality,qct.cNoOkquality,qct.sample_quality
@ -261,6 +262,7 @@
</if>
from qc_check_task qct
left join qc_check_task_user qctu on qctu.belong_to = qct.record_id
left join base_equipment be on be.equipment_type_code ='equ_type_bzx' and be.equipment_code = qct.check_loc
<if test='checkType=="checkTypeSCXJ" or checkType=="checkTypeSC"'>
left join pro_order_workorder pow on pow.workorder_code = qct.order_no
</if>

@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import javax.validation.Validator;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

@ -551,8 +551,8 @@ public class SysUserServiceImpl implements ISysUserService {
AjaxResult hrR = remoteOpenService.GetHrUserInfo(ymd);
log.info("更新人力-结果:"+ JSONObject.toJSONString(hrR));
List<HRInfo> infoList = new ArrayList<>();
if((int)hrR.get("code")==200){
infoList=JSONArray.parseArray(hrR.get("msg").toString(),HRInfo.class);
if((int)hrR.get("code")==200 && hrR.get("data")!=null){
infoList=JSONArray.parseArray(JSONObject.toJSONString(hrR.get("data")),HRInfo.class);
if(!CollectionUtils.isEmpty(infoList)){
this.syncUserInfoFunc(infoList);
}
@ -574,6 +574,20 @@ public class SysUserServiceImpl implements ISysUserService {
dto.setCreateBy(createBy);
dto.setUpdateBy(createBy);
dto.setUpdateTime(nowDate);
dto.setUserName(dto.getPeWorkID());
dto.setNickName(dto.getPeName());
dto.setSex(dto.getPeSex().equals("F")?"1":"0");//1女
dto.setStatus("0");
String[] delArrays = {"30","31","32","33","99"};
if(Arrays.asList(delArrays).contains(dto.getPeDocStatus())){
dto.setDelFlag("1");
}else{
dto.setDelFlag("0");
}
dto.setPhonenumber(dto.getPeMobilePhone());
dto.setPost(dto.getPoscd());
dto.setDeptId(Long.parseLong(dto.getOucod()));
}
int n = 0;
@ -584,23 +598,47 @@ public class SysUserServiceImpl implements ISysUserService {
//sap返回的工作中心编码-本地不存在// 差集 (list2 - list1)
List<String> noExsitCodes = codes.stream().filter(item -> !exsitCodes.contains(item)).collect(Collectors.toList());
List<HRInfo> updates = new ArrayList<>();
for(String exsitCode:exsitCodes){
List<HRInfo> updates0 = dtos.stream().filter(dto -> dto.getUserCode().equals(exsitCode)).collect(Collectors.toList());
updates.addAll(updates0);
}
List<HRInfo> updates = dtos.stream()
.filter(item -> exsitCodes.contains(item.getUserCode()))
.collect(Collectors.toList());
if(!CollectionUtils.isEmpty(updates)){
int allsize = updates.size();
int inserttimes = allsize/150+1;
for(int m=0;m<inserttimes;m++){
List<HRInfo> everyList;
if(m<(inserttimes-1)){
everyList = updates.subList(m*150,(m+1)*150);
}else{
everyList = updates.subList(m*150,allsize);
}
if(everyList.size()>0){
m = userMapper.updateUserBatchs(everyList);
System.out.println("人员新增成功条数:"+ m);
}
}
int m = userMapper.updateUserBatchs(updates);
System.out.println("人员更新成功条数:"+m);
}
List<HRInfo> adds = new ArrayList<>();
for(String noExsitCode:noExsitCodes){
List<HRInfo> adds0 = dtos.stream().filter(dto -> dto.getUserCode().equals(noExsitCode)).collect(Collectors.toList());
adds.addAll(adds0);
}
List<HRInfo> adds = dtos.stream()
.filter(item -> noExsitCodes.contains(item.getUserCode()))
.collect(Collectors.toList());
if(!CollectionUtils.isEmpty(adds)){
n = userMapper.addUserBatchs(adds);
System.out.println("人员新增成功条数:"+ n);
int allsize = adds.size();
int inserttimes = allsize/150+1;
for(int m=0;m<inserttimes;m++){
List<HRInfo> everyList;
if(m<(inserttimes-1)){
everyList = adds.subList(m*150,(m+1)*160);
}else{
everyList = adds.subList(m*150,allsize);
}
if(everyList.size()>0){
n = userMapper.addUserBatchs(everyList);
System.out.println("人员新增成功条数:"+ n);
}
}
}
return n;

@ -187,12 +187,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<insert id="addUserBatchs">
insert into sys_user
(user_name,nick_name,
post,section,
(user_name,nick_name,post,dept_id,
phonenumber,sex,status,
create_by,create_time,del_flag)
VALUES
<foreach collection="list" index="index" item="item" separator=",">
(#{item.userCode},#{item.userName},#{item.post},#{item.section},
(#{item.userName},#{item.nickName},#{item.post},#{item.deptId},
#{item.phonenumber},#{item.sex},#{item.status},
#{item.createBy},#{item.createTime},'0')
</foreach>
</insert>
@ -234,8 +235,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<foreach collection="list" item="item" separator=";">
update sys_user
set
<if test="item.section!=null">section = #{item.section},</if>
<if test="item.deptId!=null">section = #{item.deptId},</if>
<if test="item.post!=null">post = #{item.post},</if>
<if test="item.phonenumber!=null">phonenumber = #{item.phonenumber},</if>
sex = #{item.sex},
del_flag = #{item.delFlag},
update_by = #{item.updateBy},
update_time = #{updateTime}
where
@ -274,7 +278,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getExsitCodes" resultType="java.lang.String">
select user_name from sys_user where user_name in
<foreach collection="list" item="code" open="(" separator="," close=")">
#{userCode}
#{code}
</foreach>
</select>
</mapper>

@ -107,7 +107,7 @@ public class WmsSellOutTrayController extends BaseController {
/**
*
* ----
*
* @param wmsSellOutTrays
* @return
@ -118,7 +118,7 @@ public class WmsSellOutTrayController extends BaseController {
String deliveryOrder = opsForValue.get("deliveryOrder");
String productCode = opsForValue.get("productCode");
WmsSellOutEmbryo wmsSellOutEmbryo = wmsSellOutEmbryoService.selectWmsSellOutEmbryoByOrderCodeAndProductCode(deliveryOrder, productCode);
wmsSellOutEmbryo.setOutQuantity(number);
// wmsSellOutEmbryo.setOutQuantity(number);
wmsSellOutEmbryoService.updateWmsSellOutEmbryo(wmsSellOutEmbryo);
return toAjax(wmsSellOutTrayService.handSellOut(wmsSellOutTrays));
}

@ -1,6 +1,8 @@
package com.op.wms.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -104,16 +106,16 @@ public class WmsSellOutEmbryo extends BaseEntity {
*
*/
@Excel(name = "计划出库数量")
private Long planQuantity;
private BigDecimal planQuantity;
/**
*
*/
@Excel(name = "出库数量")
private Long outQuantity;
private BigDecimal outQuantity;
/**
*
* --01
*/
@Excel(name = "出库状态")
private String status;
@ -207,6 +209,15 @@ public class WmsSellOutEmbryo extends BaseEntity {
*/
@Excel(name = "有效标记")
private String activeFlag;
private List<WmsProductPutTrayCode> wmsProductPutTrayCodeList;
public List<WmsProductPutTrayCode> getWmsProductPutTrayCodeList() {
return wmsProductPutTrayCodeList;
}
public void setWmsProductPutTrayCodeList(List<WmsProductPutTrayCode> wmsProductPutTrayCodeList) {
this.wmsProductPutTrayCodeList = wmsProductPutTrayCodeList;
}
public String getActiveFlag() {
return activeFlag;
@ -328,19 +339,19 @@ public class WmsSellOutEmbryo extends BaseEntity {
return lotNumber;
}
public void setPlanQuantity(Long planQuantity) {
public void setPlanQuantity(BigDecimal planQuantity) {
this.planQuantity = planQuantity;
}
public Long getPlanQuantity() {
public BigDecimal getPlanQuantity() {
return planQuantity;
}
public void setOutQuantity(Long outQuantity) {
public void setOutQuantity(BigDecimal outQuantity) {
this.outQuantity = outQuantity;
}
public Long getOutQuantity() {
public BigDecimal getOutQuantity() {
return outQuantity;
}

@ -73,4 +73,6 @@ public interface WmsFpStorageNewsMapper {
* @return
*/
public WmsFpStorageNews selectWmsFpStorageNewsByProductCodeAndWlCode(@Param("productCode") String productCode, @Param("wlCode") String wlCode);
void updateWmsFpStorageNewsOut(WmsFpStorageNews wmsFpStorageNews);
}

@ -76,4 +76,6 @@ public interface WmsFpStorageNewsSnMapper {
* @return
*/
public WmsFpStorageNewsSn selectWmsFpStorageNewsSnBySnAndProductCode(@Param("sn") String sn, @Param("productCode") String productCode);
void updateWmsFpStorageNewsSnOut(WmsFpStorageNewsSn wmsFpStorageNewsSn);
}

@ -88,7 +88,10 @@ public interface IWmsProductPutService {
String deletSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode);
List<WmsSellOutEmbryo> selectFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo);
/**
* --
*
*/
String confirmFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo);
/**
* ----

@ -679,7 +679,56 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
@Override
public String confirmFinishedProductSales(WmsSellOutEmbryo wmsSellOutEmbryo) {
return null;
String result1="出库成功";
DynamicDataSourceContextHolder.push("ds_" + wmsSellOutEmbryo.getFactoryCode());
List<WmsProductPutTrayCode> wmsProductPutTrayCodeList= wmsSellOutEmbryo.getWmsProductPutTrayCodeList();
//成品销售出库--确认接口---修改出库单,--出库库存
WmsSellOutEmbryo wmsSellOutEmbryo1 = wmsSellOutEmbryoMapper.selectWmsSellOutEmbryoById(wmsSellOutEmbryo.getId());
Integer tem= wmsProductPutTrayCodeList.size();
BigDecimal OutQuantity= wmsSellOutEmbryo1.getOutQuantity().add(new BigDecimal(tem));
int result = wmsSellOutEmbryo1.getPlanQuantity().compareTo(OutQuantity);
WmsSellOutEmbryo wmsSellOutEmbryoUpdate=new WmsSellOutEmbryo();
if (result == 0){//出库完
wmsSellOutEmbryoUpdate.setStatus("1");
}else {
wmsSellOutEmbryoUpdate.setStatus("0");
}
wmsSellOutEmbryoUpdate.setId(wmsSellOutEmbryo.getId());
wmsSellOutEmbryoUpdate.setOutQuantity(OutQuantity);
wmsSellOutEmbryoMapper.updateWmsSellOutEmbryo(wmsSellOutEmbryo);
//订单修改完成
for(WmsProductPutTrayCode wmsProductPutTrayCode: wmsProductPutTrayCodeList){//库存修改
//解除绑定
wmsProductPutTrayCode.setRelatStatus("0");
wmsProductPutTrayCodeMapper.updateWmsProductPutTrayCode(wmsProductPutTrayCode);
//改明细
WmsFpStorageNewsSn wmsFpStorageNewsSn=new WmsFpStorageNewsSn();
wmsFpStorageNewsSn.setSn(wmsProductPutTrayCode.getSn());
wmsFpStorageNewsSn.setWlCode(wmsProductPutTrayCode.getWlCode());
wmsFpStorageNewsSn.setActiveFlag("1");
wmsFpStorageNewsSn.setProductCode(wmsSellOutEmbryo1.getProductCode());
wmsFpStorageNewsSnMapper.updateWmsFpStorageNewsSnOut(wmsFpStorageNewsSn);
//判断如果托盘数据被出完,就关闭这个明细
List<WmsFpStorageNewsSn> wmsFpStorageNewsSns= wmsFpStorageNewsSnMapper.selectWmsFpStorageNewsSnList(wmsFpStorageNewsSn);
if (wmsFpStorageNewsSns.size()>0){
WmsFpStorageNewsSn wmsFpStorageNewsSn1= wmsFpStorageNewsSns.get(0);
BigDecimal ken= new BigDecimal(wmsFpStorageNewsSn1.getUserDefined2());
int comparisonResult = ken.compareTo(wmsFpStorageNewsSn1.getAmount());
if (comparisonResult == 0) {
// ken和amount相等
wmsFpStorageNewsSn1.setActiveFlag("0");
wmsFpStorageNewsSnMapper.updateWmsFpStorageNewsSn(wmsFpStorageNewsSn1);
}
}
//改主表
WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews();
wmsFpStorageNews.setActiveFlag("1");
wmsFpStorageNews.setWlCode(wmsProductPutTrayCode.getWlCode());
wmsFpStorageNews.setProductCode(wmsSellOutEmbryo1.getProductCode());
wmsFpStorageNewsMapper.updateWmsFpStorageNewsOut(wmsFpStorageNews);
}
return result1;
}
@Override

@ -290,4 +290,9 @@
#{storageId}
</foreach>
</delete>
<update id="updateWmsFpStorageNewsOut">
update wms_fp_storage_news
set amount = COALESCE(amount, 0) - 1
where product_code = #{productCode} and wl_code = #{wlCode} and active_flag='1'
</update>
</mapper>

@ -248,4 +248,9 @@
#{storageId}
</foreach>
</delete>
<update id="updateWmsFpStorageNewsSnOut">
update wms_fp_storage_news_sn
set user_defined2 = COALESCE(user_defined2, 0) + 1
where sn=#{sn} and active_flag='1'
</update>
</mapper>

Loading…
Cancel
Save