Merge remote-tracking branch 'origin/master'

master
mengjiao 7 months ago
commit f775a70953

@ -235,6 +235,7 @@ public interface ProOrderWorkorderMapper {
List<String> getBatchDict(String batchFlag);
List<ProOrderWorkorder> getPreIdCardList(ProOrderWorkorder proOrderWorkorder);
List<ProOrderWorkorder> getPreIdCardListB(ProOrderWorkorder proOrderWorkorder);
int addBatchPallet(@Param("list")List<ProOrderWorkorder> dtos);
@ -244,5 +245,8 @@ public interface ProOrderWorkorderMapper {
void updateOnePallet(ProOrderWorkorder pw);//更新一个标识卡
List<ProOrderWorkorder> getBatchCode(String workorderId);//获取批次号下拉框
void cleanCard(ProOrderWorkorder proOrderWorkorder);
}

@ -1269,8 +1269,13 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
@DS("#header.poolName")
public List<ProOrderWorkorder> getIdCardList(ProOrderWorkorder proOrderWorkorder) {
List<ProOrderWorkorder> dtos = new ArrayList<>();
List<ProOrderWorkorder> dtos0 = proOrderWorkorderMapper.getPreIdCardList(proOrderWorkorder);
if(!CollectionUtils.isEmpty(dtos0) && dtos0.get(0).getPalletNo() == null && proOrderWorkorder.getAddFlag().equals("0")){//说明没生成过标识卡 增打标志0
//清除之前的非补打的
List<ProOrderWorkorder> dtos0 = null;
if(proOrderWorkorder.getPalletNo()==null&&proOrderWorkorder.getAddFlag().equals("0")) {//不是增打和补打
proOrderWorkorderMapper.cleanCard(proOrderWorkorder);
}
if(proOrderWorkorder.getAddFlag().equals("0")&&proOrderWorkorder.getPalletNo()==null){//非增打标志0
dtos0 = proOrderWorkorderMapper.getPreIdCardList(proOrderWorkorder);
ProOrderWorkorder pw = null;
int i = 1;
Date nowDate = DateUtils.getNowDate();
@ -1295,8 +1300,13 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
pw.setUnit(pow.getUnit());
pw.setUmrez(pw.getBatchQuantity().multiply(pow.getUmrez()));//子单数量
pw.setPalletNo(i++);
pw.setPalletCode(pow.getProductCode().replace("0000000","") + "-" +pow.getWorkorderCode() + "-"
+ pow.getBatchCode() + "-" + pw.getPalletNo());//workorderCode 实际上是订单号
//批次+板号+物料+工单号
pw.setPalletCode(
pow.getBatchCode() + "-"
+ pw.getPalletNo() + "-"
+ pow.getProductCode().replace("0000000","") + "-"
+ pow.getWorkorderCode().replace("000","")
);//workorderCode 实际上是订单号
pw.setCreateTime(nowDate);
pw.setCreateBy(SecurityUtils.getUsername());
pw.setAddFlag("0");//增打标志
@ -1305,18 +1315,28 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
}
}
}
if(!CollectionUtils.isEmpty(dtos)){
if(!CollectionUtils.isEmpty(dtos)) {//不是增打和补打
proOrderWorkorderMapper.addBatchPallet(dtos);
proOrderWorkorder.setProdType("1");//补打标识临时借用
List<ProOrderWorkorder> dtosZ = proOrderWorkorderMapper.getPreIdCardListB(proOrderWorkorder);//增打
if(!CollectionUtils.isEmpty(dtosZ)){
dtos.addAll(dtosZ);
}
}
}else if(proOrderWorkorder.getAddFlag().equals("1")){
}else if(proOrderWorkorder.getAddFlag().equals("1")){//增打
//增打 增打过来的会有批次号、批次数量、板次 增打标志1 根据唯一二维码去判断是不是生成过标识卡 有增打标志
Integer palletNo = proOrderWorkorder.getPalletNo();//板次
proOrderWorkorder.setPalletNo(null);//板次置空 去查询 获取产品等信息
List<ProOrderWorkorder> dtos1 = proOrderWorkorderMapper.getPreIdCardList(proOrderWorkorder);
ProOrderWorkorder pow = dtos1.get(0);
proOrderWorkorder.setPalletNo(palletNo);
String uniqueBarCode = pow.getProductCode().replace("0000000","") + "-" +
pow.getWorkorderCode() + "-" + proOrderWorkorder.getBatchCode() + "-" + palletNo;//订单号+批次+板次 唯一二维码标识
//批次+板号+物料+工单号
// String uniqueBarCode = pow.getProductCode().replace("0000000","") + "-" +
// pow.getWorkorderCode() + "-" + proOrderWorkorder.getBatchCode() + "-" + palletNo;//订单号+批次+板次 唯一二维码标识
String uniqueBarCode = proOrderWorkorder.getBatchCode() + "-"
+ palletNo + "-"
+ pow.getProductCode().replace("0000000","") + "-"
+ pow.getWorkorderCode().replace("000","");
ProOrderWorkorder pw = new ProOrderWorkorder();
pw.setProductName(pow.getProductName());//产品名
pw.setWorkorderCode(pow.getWorkorderCode());//工单号 实际是订单号
@ -1348,9 +1368,10 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService {
return dto;
}
dtos.add(pw);
}else if(!CollectionUtils.isEmpty(dtos0) && dtos0.get(0).getPalletNo() != null && proOrderWorkorder.getAddFlag().equals("0")){
dtos.addAll(dtos0);
}else if(proOrderWorkorder.getAddFlag().equals("0")
&&proOrderWorkorder.getPalletNo()!=null){////补打
dtos = proOrderWorkorderMapper.getPreIdCardListB(proOrderWorkorder);
dtos.get(0).setUmrez(dtos.get(0).getBatchQuantity().multiply(dtos.get(0).getUmrez()));//子单数量
}
return dtos;
}

@ -686,20 +686,40 @@
pow.product_date productDateStr,
pow.workorder_code_sap workorderCode,
powb.batch_code batchCode,
case when powbp.quantity is not null then powbp.quantity
else powb.batch_quantity end batchQuantity,pow.unit,
powb.batch_quantity batchQuantity,
pow.unit,
bpa.pallet_num palletNum,
concat(REPLACE(pow.product_code, '0000000', ''),'-',pow.workorder_code_sap,'-', powb.batch_code,'-',powbp.pallet_num) palletCode,
powbp.pallet_num palletNo,
bp.umrez
from pro_order_workorder pow
left join pro_order_workorder_batch powb on pow.workorder_id = powb.workorder_id
left join base_product_attached bpa on concat('0000000',bpa.product_code) = pow.product_code
left join base_product bp on bp.product_code = pow.product_code
where pow.workorder_code = #{workorderCode} and pow.del_flag = '0' and powb.del_flag = '0'
order by powb.batch_code
</select>
<select id="getPreIdCardListB" resultType="com.op.plan.domain.ProOrderWorkorder">
select pow.product_name productName,
pow.product_code productCode,
pow.product_date productDateStr,
pow.workorder_code_sap workorderCode,
powb.batch_code batchCode,
powbp.quantity batchQuantity,pow.unit,
powbp.pallet_num palletNo,
bp.umrez,
concat(powb.batch_code,'-',
powbp.pallet_num,'-',
REPLACE(pow.product_code, '0000000', ''),'-',
REPLACE(pow.workorder_code_sap, '000', '')) palletCode
from pro_order_workorder pow
left join pro_order_workorder_batch powb on pow.workorder_id = powb.workorder_id
left join base_product_attached bpa on concat('0000000',bpa.product_code) = pow.product_code
left join base_product bp on bp.product_code = pow.product_code
left join pro_order_workorder_batch_pallet powbp on powbp.workorder_code = pow.workorder_code_sap
and powbp.batch_code = powb.batch_code
and powbp.batch_code = powb.batch_code
where pow.workorder_code = #{workorderCode} and pow.del_flag = '0' and powb.del_flag = '0'
<if test="palletNo != null">and powbp.pallet_num = #{palletNo}</if>
<if test="prodType != null">and powbp.add_flag = #{prodType}</if>
order by CAST(powbp.pallet_num AS INT),powb.batch_code
</select>
@ -847,6 +867,7 @@
and pow.del_flag = '0'
and pow.workorder_id = #{workorderId}
</select>
<insert id="addBatchPallet">
INSERT INTO pro_order_workorder_batch_pallet (
id,workorder_code,batch_code,quantity,pallet_num,create_by,
@ -984,6 +1005,11 @@
#{orderId}
</foreach>
</delete>
<delete id="cleanCard">
delete from pro_order_workorder_batch_pallet where workorder_code in(
select workorder_code_sap from pro_order_workorder where workorder_code = #{workorderCode}
) and add_flag = '0'
</delete>
<update id="updateCheckTaskBatch" parameterType="com.op.plan.domain.dto.CheckTaskBatchDTO">
update qc_check_task set income_batch_no = #{newIncomeBatchNo}
where income_batch_no = #{incomeBatchNo} and order_no = #{orderNo}

@ -83,4 +83,5 @@ public interface QcCheckTypeProjectMapper {
QcProjectType getProductGroup(String materialCode);
QcMaterialGroupDetail selectExist(QcMaterialGroupDetail materialGroupDetail);
}

@ -28,6 +28,7 @@ import com.op.system.api.RemoteUserService;
import com.op.system.api.domain.SysNoticeGroup;
import com.op.system.api.domain.SysUser;
import com.op.system.api.domain.dto.WechartDTO;
import com.op.system.api.domain.quality.QcUserMaterialDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -209,6 +210,29 @@ public class QcCheckTaskInventoryServiceImpl implements IQcCheckTaskInventorySer
}
//检验人插入
qcCheckTaskUserService.insertQcCheckTaskUserList(qcCheckTaskUserList);
}else{//定时任务触发
qcCheckTaskInventory.setCheckManName("");
qcCheckTaskInventory.setCheckManCode("");
/**qc_user_material取默认检查人**/
List<QcUserMaterialDTO> users = qcCheckTaskIncomeMapper.getUserByCheckType(qcCheckTaskInventory.getCheckType());
if(CollectionUtils.isEmpty(users)){
QcUserMaterialDTO dto0 = new QcUserMaterialDTO();
dto0.setUserCode("mobile");
dto0.setUserName("手持测试用户");
users.add(dto0);
}else{
for(QcUserMaterialDTO user:users){
user.setId(IdUtils.fastSimpleUUID());
user.setBelongTo(beLongId);
user.setCheckNo(qcCheckTaskInventory.getCheckNo());
user.setCreateBy(createBy);
user.setFactoryCode(factoryCode);
user.setCreateTime(nowDate);
}
}
/**qc_check_task_user**/
int m=qcCheckTaskIncomeMapper.addCheckUsers(users);
logger.info("检查人新增"+m+"成功");
}
/** 不良品数据插入 */
BigDecimal noOkQuality = new BigDecimal(0);

@ -139,7 +139,7 @@
td.property_code propertyCode,
td.check_mode checkMode,
td.check_tool checkTool,
td.unit_code unitCode,
dic.dict_label unitCode,
td.check_standard checkStandard,
td.actual_value actualValue,
td.status,
@ -161,6 +161,7 @@
qctp.weight
from qc_check_task_detail td
left join qc_check_type_project qctp on td.type_project_id = qctp.id
left join lanju_op_cloud.dbo.sys_dict_data dic on dic.dict_value = td.unit_code and dic.status ='0'
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>

@ -298,68 +298,29 @@
t0.quality,
t0.incomeTime,
t0.supplierCode,
t0.supplierName
t0.supplierName,
t0.check_Type
from (
select t.*,bp.warehouse_cycle,
case when qct.create_time is not null then DATEDIFF(day, qct.create_time, GETDATE())
else DATEDIFF(day, t.incomeTime, GETDATE()) end days
from (
SELECT
wms_raw_order_in_sn.po_no AS orderNo,
wms_raw_order_in_sn.material_code AS materialCode,
wms_raw_order_in_sn.material_desc AS materialName,
COUNT(wms_raw_order_in_sn.amount) AS quality,
wms_raw_order_in_sn.gmt_create incomeTime,
wms_raw_order_in_sn.wh_code supplierCode,
base_warehouse.warehouse_name supplierName,
wms_raw_order_in_sn.user_defined4 unit
FROM
wms_raw_order_in_sn
LEFT JOIN base_warehouse ON base_warehouse.warehouse_code=wms_raw_order_in_sn.wh_code
WHERE
wms_raw_order_in_sn.active_flag = '1'
GROUP BY
wms_raw_order_in_sn.wh_code,
wms_raw_order_in_sn.po_no,
wms_raw_order_in_sn.material_code,
wms_raw_order_in_sn.material_desc,
wms_raw_order_in_sn.user_defined4,
base_warehouse.warehouse_code,
base_warehouse.warehouse_name,
wms_raw_order_in_sn.gmt_create
union all
SELECT
wms_fp_storage_news_sn.order_no,
wms_fp_storage_news_sn.product_name,
wms_fp_storage_news_sn.product_code,
SUM ( wms_fp_storage_news_sn.amount ) AS total_amount,
wms_fp_storage_news_sn.gmt_create,
wms_fp_storage_news_sn.wh_code ,
base_warehouse.warehouse_name,
wms_fp_storage_news_sn.user_defined3
FROM
wms_fp_storage_news_sn
LEFT JOIN base_warehouse ON base_warehouse.warehouse_code=wms_fp_storage_news_sn.wh_code
WHERE
wms_fp_storage_news_sn.active_flag = '1'
GROUP BY
wms_fp_storage_news_sn.order_no,
wms_fp_storage_news_sn.product_name,
wms_fp_storage_news_sn.product_code,
wms_fp_storage_news_sn.gmt_create,
wms_fp_storage_news_sn.user_defined3,
base_warehouse.warehouse_code,
base_warehouse.warehouse_name,
wms_fp_storage_news_sn.wh_code
) t
left join base_product_attached bp on t.materialCode = concat('0000000',bp.product_code)
left join (
select t.order_no orderNo,
t.material_code materialCode,
t.material_name materialName,
t.quality quality,
t.income_time incomeTime,
t.supplier_code supplierCode,
t.supplier_name supplierName,
t.check_type check_Type,
bp.warehouse_cycle,
case when qct.create_time is not null then DATEDIFF(day, qct.create_time, GETDATE())
else DATEDIFF(day, t.income_time, GETDATE()) end days
from qc_check_task t
left join base_product_attached bp on t.material_code = concat('0000000',bp.product_code)
left join (
select order_no,material_code,max(create_time) create_time
from qc_check_task where check_type='checkTypeCC' and del_flag = '0' GROUP BY order_no,material_code
) qct on qct.order_no = t.orderNo
and t.materialCode = qct.material_code
where bp.warehouse_cycle is not null
)t0
) qct on qct.order_no = t.order_no
and t.material_code = qct.material_code
where bp.warehouse_cycle is not null and t.check_type in('checkTypeLL','checkTypeCP') and t.del_flag = '0'
)t0
where t0.days >= t0.warehouse_cycle
</select>

@ -42,7 +42,7 @@
<select id="selectQcCheckTypeProjectList" parameterType="QcCheckTypeProject" resultMap="QcCheckTypeProjectResult">
SELECT
ctp.id,ctp.project_no,ctp.project_id,
cp.rule_name,cp.property_code,cp.unit_code unit,ctp.type_id,
cp.rule_name,cp.property_code,ctp.unit,ctp.type_id,
ctp.standard_value,ctp.upper_diff,ctp.down_diff,ctp.sample,ctp.status,
ctp.create_by, ctp.create_time,ctp.update_by,ctp.update_time,
ctp.factory_code, ctp.del_flag,ctp.group_id,ctp.material_code,ctp.sample_num,ctp.sort
@ -78,7 +78,8 @@
ctp.update_by,ctp.update_time,
ctp.factory_code,ctp.del_flag,
ctp.group_id,ctp.material_code,
ctp.sample_num,ctp.sort,ctp.weight
ctp.sample_num,ctp.sort,ctp.weight,
ctp.unit
FROM qc_check_type_project ctp
LEFT JOIN qc_check_project cp ON ctp.project_id = cp.id AND cp.del_flag = '0'
WHERE ctp.del_flag ='0' AND ctp.id = #{id}
@ -95,7 +96,7 @@
qcp.rule_name ruleName,
qcp.property_code propertyCode,
qcp.check_tool checkTool,
qcp.unit_code unitCode,
qctp.unit unitCode,
qcp.check_mode checkMode
<!--,qcp.check_standard checkStandard-->
from qc_check_type_project qctp
@ -117,7 +118,7 @@
qcp.rule_name ruleName,
qcp.property_code propertyCode,
qcp.check_tool checkTool,
qcp.unit_code unitCode,
qctp.unit unitCode,
qcp.check_mode checkMode
<!--,qcp.check_standard checkStandard-->
from qc_check_type_project qctp

Loading…
Cancel
Save