移动破调整
This commit is contained in:
parent
9cebd0f021
commit
5aef3c1fe5
|
|
@ -346,21 +346,16 @@ public class OptionalEbomApi extends BaseApi {
|
|||
@PostMapping("publish")
|
||||
@ApiOperation("发布生成")
|
||||
public ResultVO<String> publish(@RequestBody OptionalEbomPublishAddDTO dto) {
|
||||
if(StrUtil.isEmpty(dto.getGoodsDesc())){
|
||||
return ResultVO.error("输入制作/发货包信息");
|
||||
}
|
||||
if(StrUtil.isEmpty(dto.getMachineDesc())){
|
||||
return ResultVO.error("输入机械部分信息");
|
||||
}else{
|
||||
if(!dto.getMachineDesc().contains(" ")){
|
||||
return ResultVO.error("机械部分格式错误");
|
||||
}
|
||||
}
|
||||
if(StrUtil.isEmpty(dto.getElectricDesc())){
|
||||
return ResultVO.error("输入电控制作/发货信息");
|
||||
|
||||
if(Objects.isNull(dto.getRowId())){
|
||||
return ResultVO.error("发布的数据rowId不能为空");
|
||||
}
|
||||
|
||||
|
||||
if(StrUtil.isEmpty(dto.getMachineNo())){
|
||||
return ResultVO.error("输入机台号");
|
||||
}
|
||||
|
||||
|
||||
return publishMaterialService.publishWork(dto);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class OptionalEbomPublishAddDTO implements Serializable {
|
|||
@ApiModelProperty(value = "发布数据id")
|
||||
private Long rowId;
|
||||
|
||||
@ApiModelProperty(value = "制作/发货包")
|
||||
@ApiModelProperty(value = "整机制作/发货包")
|
||||
private String goodsDesc;
|
||||
|
||||
@ApiModelProperty(value = "机械部分")
|
||||
|
|
@ -27,6 +27,10 @@ public class OptionalEbomPublishAddDTO implements Serializable {
|
|||
@ApiModelProperty(value = "电控制作/发货")
|
||||
private String electricDesc;
|
||||
|
||||
@ApiModelProperty(value = "机台号")
|
||||
private String machineNo;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -112,4 +112,9 @@ public class OptionalEbomMainEntity implements Serializable {
|
|||
@TableField(value = "real_name")
|
||||
@ApiModelProperty(value = "创建人姓名")
|
||||
private String realName;
|
||||
|
||||
@TableField(value = "serial_no")
|
||||
@ApiModelProperty(value = "序号")
|
||||
private Integer serialNo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,4 +83,7 @@ public class OptionalEbomMainVO implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "创建人姓名")
|
||||
private String realName;
|
||||
@ApiModelProperty(value = "序号")
|
||||
private Integer serialNo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@ public class MaterialService {
|
|||
|
||||
|
||||
//测试用 生成编码
|
||||
// try {
|
||||
// Thread.sleep(100);
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
// String s=DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS");
|
||||
// try {
|
||||
// Thread.sleep(100);
|
||||
// }catch (Exception e){
|
||||
//
|
||||
// }
|
||||
// String s=DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS");
|
||||
|
||||
|
||||
HttpUtils httpUtils = new HttpUtils();
|
||||
|
|
@ -89,6 +89,8 @@ public class MaterialService {
|
|||
return result.getData().toString();
|
||||
}
|
||||
VUtils.isTure(true).throwMessage("申请物料失败" + result.getMsg());
|
||||
|
||||
|
||||
return s;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.nflg.product.bomnew.pojo.dto.OptionalEbomPublishAddDTO;
|
|||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.util.OrderNoUtil;
|
||||
import nflg.product.common.constant.STATE;
|
||||
import nflg.product.common.vo.ResultVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -82,15 +83,42 @@ public class PublishMaterialService {
|
|||
return ResultVO.error("发布未查询到物料数据");
|
||||
}
|
||||
|
||||
List<OptionalMbomMaterialEntity> materialList = new ArrayList<>();
|
||||
|
||||
OptionalEbomConfigEntity configEntity=SpringUtil.getBean(OptionalEbomConfigService .class).getById(optionalEbomPublishAddDTO.getRowId());
|
||||
|
||||
if(configEntity ==null ){
|
||||
return ResultVO.error(StrUtil.format("{} 暂存数据查询到",optionalEbomPublishAddDTO.getRowId()));
|
||||
}
|
||||
OptionalEbomMainEntity mainEntity=SpringUtil.getBean(OptionalEbomMainService.class).getById(configEntity.getParentRowId());
|
||||
|
||||
if(mainEntity ==null ){
|
||||
return ResultVO.error(StrUtil.format("{} 设备数据未查询到",configEntity.getParentRowId()));
|
||||
}
|
||||
|
||||
//整机物料名称和物料描述=机型+机型名称+机台号+.0
|
||||
optionalEbomPublishAddDTO.setGoodsDesc(StrUtil.format("{}{}{}",
|
||||
mainEntity.getDeviceNo(),
|
||||
mainEntity.getDeviceName(),
|
||||
optionalEbomPublishAddDTO.getMachineNo()
|
||||
).concat(".0"));
|
||||
|
||||
//电控发货物料生成规则: 规则:物料名称和物料描述=(机型+机台号+.0)
|
||||
optionalEbomPublishAddDTO.setElectricDesc(StrUtil.format("{}{}",
|
||||
mainEntity.getDeviceNo(),
|
||||
optionalEbomPublishAddDTO.getMachineNo()
|
||||
).concat(".0"));
|
||||
|
||||
|
||||
List<OptionalMbomMaterialEntity> materialList = new ArrayList<>();
|
||||
try {
|
||||
|
||||
|
||||
//第一层级 机型发货 和制作
|
||||
Long parentId = genVirtualPackLevel1(materialList, optionalEbomPublishAddDTO.getRowId(), optionalEbomPublishAddDTO.getGoodsDesc());
|
||||
//电控部分
|
||||
genVirtualPackElectricLevel2(materialList, optionalEbomPublishAddDTO.getRowId(), parentId, optionalEbomPublishAddDTO.getElectricDesc());
|
||||
//机械部分申请
|
||||
genVirtualPackMachineLevel2(materialList, optionList, optionalEbomPublishAddDTO.getRowId(), parentId, optionalEbomPublishAddDTO.getMachineDesc());
|
||||
genVirtualPackMachineLevel2(materialList, optionList, optionalEbomPublishAddDTO.getRowId(), parentId,mainEntity.getRowId() );
|
||||
|
||||
boolean ok = optionalMbomMaterialService.saveBatch(materialList);
|
||||
|
||||
|
|
@ -133,7 +161,7 @@ public class PublishMaterialService {
|
|||
String sendMaterialName = goodsDesc.concat("(发货)");
|
||||
sendPack.setRowId(IdWorker.getId());
|
||||
sendPack.setCreatedBy(SessionUtil.getUserCode());
|
||||
sendPack.setCreatedTime(DateUtil.now());
|
||||
sendPack.setCreatedTime(DateUtil.now());
|
||||
sendPack.setMaterialName(sendMaterialName);
|
||||
sendPack.setMaterialDesc(sendMaterialName);
|
||||
sendPack.setRootRowId(rootRowId);
|
||||
|
|
@ -214,10 +242,10 @@ public class PublishMaterialService {
|
|||
* @param materialList
|
||||
* @param rootRowId
|
||||
* @param parentId
|
||||
* @param desc
|
||||
|
||||
* @return
|
||||
*/
|
||||
private void genVirtualPackMachineLevel2(List<OptionalMbomMaterialEntity> materialList, List<OptionalEbomImportChildVO> optionList, Long rootRowId, Long parentId, String desc) throws NflgBusinessException {
|
||||
private void genVirtualPackMachineLevel2(List<OptionalMbomMaterialEntity> materialList, List<OptionalEbomImportChildVO> optionList, Long rootRowId, Long parentId,Long deviceRowId) throws NflgBusinessException {
|
||||
|
||||
List<Long> materialNoList = optionList.stream().filter(u-> u.getPartType().equals(OptionalBomConstant.PartTypeEnum.PART_TYPE_RADIO.getValue()) ).map(OptionalEbomImportChildVO::getMaterialNo).map(Long::parseLong).collect(Collectors.toList());
|
||||
Collections.sort(materialNoList);
|
||||
|
|
@ -230,27 +258,25 @@ public class PublishMaterialService {
|
|||
OptionalMbomMaterialEntity material;
|
||||
if (optionalMbomCompareEntity == null) {
|
||||
material = new OptionalMbomMaterialEntity();
|
||||
//第一个空格位置图号
|
||||
String drawingNo = StrUtil.sub(desc, 0, desc.indexOf(" "));
|
||||
OptionalEbomMainEntity desc= SpringUtil.getBean(OptionalEbomMainService.class).getById(deviceRowId);
|
||||
|
||||
//物料名称和物料描述=机型+流水号+NF(机械部分)
|
||||
//图号=机型+流水号+NF
|
||||
String drawingNo =StrUtil.format("{}{}",desc.getDeviceNo(), OrderNoUtil.orderNo2Str(desc.getSerialNo())).concat("NF");
|
||||
String materialName=drawingNo.concat("(机械部分)");
|
||||
material.setRowId(IdWorker.getId());
|
||||
material.setDrawingNo(drawingNo);
|
||||
material.setParentRowId(parentId);
|
||||
material.setRootRowId(rootRowId);
|
||||
material.setCreatedBy(SessionUtil.getUserCode());
|
||||
material.setCreatedTime(DateUtil.now());
|
||||
material.setMaterialName(desc);
|
||||
material.setMaterialDesc(desc);
|
||||
material.setMaterialName(materialName);
|
||||
material.setMaterialDesc(materialName);
|
||||
material.setMaterialNo("");//申请物料号
|
||||
|
||||
try {
|
||||
String data = materialService.addMaterial(material.getDrawingNo(), material.getMaterialName(), OptionalBomConstant.PublishMaterialEnum.MACHINE.getCategory());
|
||||
// ResultVO<String> resultVO = JSON.parseObject(data, new com.alibaba.fastjson.TypeReference<ResultVO<String>>(){});
|
||||
// if (resultVO == null) {
|
||||
// throw new NflgBusinessException(STATE.Error, "机械部分物料编码申请失败,联系管理员," + data);
|
||||
// }
|
||||
// if (!Objects.equal(resultVO.getState(), STATE.Success.getState())) {
|
||||
// throw new NflgBusinessException(STATE.Error, resultVO.getMsg());
|
||||
// }
|
||||
|
||||
material.setMaterialNo(data);
|
||||
} catch (Exception e) {
|
||||
throw new NflgBusinessException(STATE.Error, "机械部分," + e.getMessage());
|
||||
|
|
@ -267,12 +293,22 @@ public class PublishMaterialService {
|
|||
optionalMbomCompareEntity.setCreatedTime(DateUtil.now());
|
||||
optionalMbomCompareEntity.setChildRowIds(result);
|
||||
optionalMbomCompareService.save(optionalMbomCompareEntity);
|
||||
|
||||
//更新序列号
|
||||
OptionalEbomMainEntity updateDevice=new OptionalEbomMainEntity();
|
||||
updateDevice.setRowId(desc.getRowId());
|
||||
updateDevice.setSerialNo(desc.getSerialNo()+1);
|
||||
SpringUtil.getBean(OptionalEbomMainService.class).updateById(updateDevice);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
} else { //同物料号
|
||||
material = Convert.convert(new TypeReference<OptionalMbomMaterialEntity>() {
|
||||
}, optionalMbomCompareEntity);
|
||||
|
|
@ -291,6 +327,7 @@ public class PublishMaterialService {
|
|||
materialList.add(material);
|
||||
List<OptionalMbomMaterialEntity> optionConvertList = Convert.toList(OptionalMbomMaterialEntity.class, optionList);
|
||||
optionConvertList.forEach(item -> {
|
||||
item.setRowId(null);
|
||||
item.setCreatedBy(SessionUtil.getUserCode());
|
||||
item.setCreatedTime(DateUtil.now());
|
||||
item.setRootRowId(rootRowId);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
|
||||
</select>
|
||||
|
||||
|
||||
<!--and (t1.material_no!=null or t1.material_no!='')-->
|
||||
<select id="getPreviewOptionList" resultType="com.nflg.product.bomnew.pojo.vo.OptionalEbomImportChildVO" >
|
||||
SELECT t1.row_id,
|
||||
t1.parent_row_id,
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
t1.choose_status,
|
||||
t2.choose_status as option_status from
|
||||
t_optional_ebom_config_r as t2 LEFT JOIN t_optional_ebom_import_child as t1 on t2.option_row_id=t1.row_id
|
||||
where t1.is_enable=1 and t2.choose_status =1 and t2.parent_row_id=#{rowId} and (t1.material_no!=null or t1.material_no!='')
|
||||
where t1.is_enable=1 and t2.choose_status =1 and t2.parent_row_id=#{rowId} and t1.material_name!='无'
|
||||
</select>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ row_id,parent_row_id,root_row_id,material_no,material_name,material_desc,drawing
|
|||
<if test="query.startDate != null and query.startDate != '' and query.endDate != null and query.endDate != ''">
|
||||
<![CDATA[ and created_time >= #{query.startDate} and created_time <= #{query.endDate}]]>
|
||||
</if>
|
||||
|
||||
order by created_time asc
|
||||
limit 0,1000
|
||||
|
||||
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -16,12 +16,13 @@
|
|||
<result property="realName" column="real_name" />
|
||||
<result property="createdTime" column="created_time" />
|
||||
<result property="updatedTime" column="updated_time" />
|
||||
<result property="serialNo" column="serial_no" />
|
||||
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
row_id
|
||||
,device_no,device_name,remark,is_enable,dept_row_id,dept_name,created_by,created_time,updated_time,updated_by,real_name,is_del
|
||||
,device_no,device_name,remark,is_enable,dept_row_id,dept_name,created_by,created_time,updated_time,updated_by,real_name,is_del,serial_no
|
||||
</sql>
|
||||
|
||||
<sql id="where_whr">
|
||||
|
|
|
|||
Loading…
Reference in New Issue