rev:修改半成品库存相关字段

This commit is contained in:
2023-09-19 17:54:07 +08:00
parent 200b799372
commit 18452c8181
9 changed files with 127 additions and 74 deletions

View File

@@ -137,6 +137,15 @@ public class MaterialbaseServiceImpl implements MaterialbaseService{
return dto;
}
public MaterialbaseDto findById(String material_id) {
MdMeMaterialbase materialbase = materialbaseService.getOne(new QueryWrapper<MdMeMaterialbase>().eq("material_id", material_id));
MdPbMeasureunit unit = mdPbMeasureunitService.getOne(new QueryWrapper<MdPbMeasureunit>().eq("measure_unit_id", materialbase.getBase_unit_id()));
MaterialbaseDto dto = new MaterialbaseDto();
BeanUtils.copyProperties(materialbase, dto);
dto.setBase_unit_name(unit.getUnit_name());
return dto;
}
@Override
public MaterialbaseDto findByCode(String code) {
if(StrUtil.isNotEmpty(code) && code.contains("\\")) {

View File

@@ -91,7 +91,8 @@ public class PcsIfPurchaseorderController{
@PostMapping("/update")
@Log("修改原料计划")
//("修改原料需求")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson)
throws ParseException {
purchaseorderService.update(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}

View File

@@ -57,5 +57,6 @@ public interface IPcsIfPurchaseorderService extends IService<PcsIfPurchaseorder>
/**
* 原料需求单修改
*/
void update(JSONObject form);
void update(JSONObject form)
throws ParseException;
}

View File

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -178,4 +179,10 @@ public class PcsIfPurchaseorder implements Serializable{
* 对应半成品物料规格
*/
private String semireal_spec;
/**
* aps到货时间
*/
private Date aps_instorage_time;
}

View File

@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.Data;
import org.apache.poi.hpsf.Decimal;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
@@ -192,6 +193,8 @@ public class PcsIfPurchaseorderServiceImpl extends ServiceImpl<PcsIfPurchaseorde
if(status.equals(PCSEnum.BILL_STATUS.code("提交")) && (StrUtil.isNotBlank(po_code) && StrUtil.isNotBlank(agree_time))) {
order.setPo_code(po_code);
order.setAgree_time(agree_time);
//aps到货时间
order.setAps_instorage_time(org.nl.modules.common.utils.DateUtil.toDateByStartTime(agree_time));
order.setStatus(PCSEnum.BILL_STATUS.code("确认采购"));
order.setPurchase_id("0");
order.setPurchase_name("EXCEL导入");
@@ -212,30 +215,33 @@ public class PcsIfPurchaseorderServiceImpl extends ServiceImpl<PcsIfPurchaseorde
}
@Override
public void update(JSONObject form) {
public void update(JSONObject form)
throws ParseException {
JSONArray rows = form.getJSONArray("tableData");
for(int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
//需求单
if(!PCSEnum.BILL_STATUS.code("生成").equals(row.getString("status"))) {
if(StrUtil.isNotBlank(row.getString("po_code")) && StrUtil.isNotBlank(row.getString("agree_time"))) {
PcsIfPurchaseorder purchase = row.toJavaObject(PcsIfPurchaseorder.class);
if(purchase.getStatus().equals(PCSEnum.BILL_STATUS.code("提交"))) {
purchase.setStatus(PCSEnum.BILL_STATUS.code("确认采购"));
purchase.setPurchase_id(SecurityUtils.getCurrentUserId());
purchase.setPurchase_time(DateUtil.now());
purchase.setPurchase_name(SecurityUtils.getCurrentNickName());
for(int i = 0; i < rows.size(); i++) {
JSONObject row = rows.getJSONObject(i);
//需求单
if(!PCSEnum.BILL_STATUS.code("生成").equals(row.getString("status"))) {
if(StrUtil.isNotBlank(row.getString("po_code")) && StrUtil.isNotBlank(row.getString("agree_time"))) {
PcsIfPurchaseorder purchase = row.toJavaObject(PcsIfPurchaseorder.class);
//aps到货时间
purchase.setAps_instorage_time(org.nl.modules.common.utils.DateUtil.toDateByStartTime(purchase.getAgree_time()));
if(purchase.getStatus().equals(PCSEnum.BILL_STATUS.code("提交"))) {
purchase.setStatus(PCSEnum.BILL_STATUS.code("确认采购"));
purchase.setPurchase_id(SecurityUtils.getCurrentUserId());
purchase.setPurchase_time(DateUtil.now());
purchase.setPurchase_name(SecurityUtils.getCurrentNickName());
}
purchaseorderMapper.updateById(purchase);
}
else{
throw new BadRequestException("请检查订单编号或到料日期是否都已填写!");
}
purchaseorderMapper.updateById(purchase);
}
else{
throw new BadRequestException("请检查订单编号或到料日期是否都已填写!");
PcsIfDemandorder purchase = row.toJavaObject(PcsIfDemandorder.class);
pcsIfDemandorderService.updateById(purchase);
}
}
else{
PcsIfDemandorder purchase = row.toJavaObject(PcsIfDemandorder.class);
pcsIfDemandorderService.updateById(purchase);
}
}
}
}

View File

@@ -81,6 +81,11 @@ public class StIvtIostorinvdisYl implements Serializable {
*/
private String material_id;
/**
* 物料编码
*/
private String material_code;
/**
* 批次
*/

View File

@@ -189,6 +189,9 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
.instorage_time(DateUtil.now())
.stor_id(mst.getStor_id())
.workshop_id(mst.getWorkshop_id())
.material_code(dis.getMaterial_code())
.aps_instorage_time(DateUtil.now())
.aps_sale_type("I")//对应aps订单种类为绝对库存
.build();
structivtYlService.save(ivtDao);

View File

@@ -11,6 +11,9 @@ import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtSectattrServic
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtSectattr;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.masterdata_manage.备份master.service.MaterialbaseService;
import org.nl.wms.masterdata_manage.备份master.service.dto.MaterialbaseDto;
import org.nl.wms.masterdata_manage.备份master.service.impl.MaterialbaseServiceImpl;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdisYl;
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdtlYl;
@@ -20,6 +23,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -31,59 +35,63 @@ import java.util.List;
* @since 2023-05-10
*/
@Service
public class StIvtIostorinvdisYlServiceImpl extends ServiceImpl<StIvtIostorinvdisYlMapper, StIvtIostorinvdisYl> implements IStIvtIostorinvdisYlService {
public class StIvtIostorinvdisYlServiceImpl extends ServiceImpl<StIvtIostorinvdisYlMapper,StIvtIostorinvdisYl> implements IStIvtIostorinvdisYlService{
@Autowired
private IStIvtSectattrService sectattrService;
@Autowired
private IStIvtStructattrService structattrService;
@Resource
private MaterialbaseServiceImpl materialbaseService;
@Autowired
private IStIvtSectattrService sectattrService;
@Autowired
private IStIvtStructattrService structattrService;
@Override
public void create(JSONObject jo, JSONObject mst_jo) {
if(ObjectUtil.isNotEmpty(mst_jo)) {
String mst_id = mst_jo.getString("mst_id");
String dtl_id = mst_jo.getString("dtl_id");
String iostorinvdisYl_id = IdUtil.getStringId();
StIvtIostorinvdisYl row = jo.toJavaObject(StIvtIostorinvdisYl.class);
row.setIostorinv_id(mst_id);
row.setIostorinvdtl_id(dtl_id);
row.setIostorinvdtl_id(dtl_id);
row.setIostorinvdis_id(iostorinvdisYl_id);
List<StIvtIostorinvdisYl> list = this.list(new QueryWrapper<StIvtIostorinvdisYl>().eq("iostorinvdtl_id", dtl_id));
row.setSeq_no(list.size() + 1);
row.setIs_active(true);
row.setWork_status(IOSEnum.WORK_STATUS.code("未生成"));
row.setPlan_qty(row.getPlan_qty());
// 获取库区信息
QueryWrapper<StIvtSectattr> sect_wrapper = new QueryWrapper<>();
sect_wrapper.eq("sect_id", row.getSect_id());
sect_wrapper.eq("is_used", true);
StIvtSectattr sectDao = sectattrService.getOne(sect_wrapper);
if(ObjectUtil.isEmpty(sectDao)) {
throw new BadRequestException("库区不存在或未启用!");
}
row.setSect_code(sectDao.getSect_code());
row.setSect_name(sectDao.getSect_name());
// 获取仓位信息
QueryWrapper<StIvtStructattr> struct_wrapper = new QueryWrapper<>();
struct_wrapper.eq("struct_id", row.getStruct_id());
struct_wrapper.eq("is_used", true);
StIvtStructattr structDao = structattrService.getOne(struct_wrapper);
if(ObjectUtil.isEmpty(structDao)) {
throw new BadRequestException("仓位不存在或未启用!");
}
//查询物料信息
MaterialbaseDto materialbaseDto = materialbaseService.findById(row.getMaterial_id());
if(ObjectUtil.isEmpty(materialbaseDto)) {
throw new BadRequestException("物料信息不存在!");
}
row.setMaterial_code(materialbaseDto.getMaterial_code());
row.setStruct_code(structDao.getStruct_code());
row.setStruct_name(structDao.getStruct_name());
row.setPcsn(DateUtil.today());
this.save(row);
}
}
@Override
public void create(JSONObject jo, JSONObject mst_jo) {
if (ObjectUtil.isNotEmpty(mst_jo)) {
String mst_id = mst_jo.getString("mst_id");
String dtl_id = mst_jo.getString("dtl_id");
String iostorinvdisYl_id = IdUtil.getStringId();
StIvtIostorinvdisYl row = jo.toJavaObject(StIvtIostorinvdisYl.class);
row.setIostorinv_id(mst_id);
row.setIostorinvdtl_id(dtl_id);
row.setIostorinvdtl_id(dtl_id);
row.setIostorinvdis_id(iostorinvdisYl_id);
List<StIvtIostorinvdisYl> list = this.list(new QueryWrapper<StIvtIostorinvdisYl>().eq("iostorinvdtl_id", dtl_id));
row.setSeq_no(list.size() + 1);
row.setIs_active(true);
row.setWork_status(IOSEnum.WORK_STATUS.code("未生成"));
row.setPlan_qty(row.getPlan_qty());
// 获取库区信息
QueryWrapper<StIvtSectattr> sect_wrapper = new QueryWrapper<>();
sect_wrapper.eq("sect_id", row.getSect_id());
sect_wrapper.eq("is_used", true);
StIvtSectattr sectDao = sectattrService.getOne(sect_wrapper);
if (ObjectUtil.isEmpty(sectDao)) throw new BadRequestException("库区不存在或未启用!");
row.setSect_code(sectDao.getSect_code());
row.setSect_name(sectDao.getSect_name());
// 获取仓位信息
QueryWrapper<StIvtStructattr> struct_wrapper = new QueryWrapper<>();
struct_wrapper.eq("struct_id", row.getStruct_id());
struct_wrapper.eq("is_used", true);
StIvtStructattr structDao = structattrService.getOne(struct_wrapper);
if (ObjectUtil.isEmpty(structDao)) throw new BadRequestException("仓位不存在或未启用!");
row.setStruct_code(structDao.getStruct_code());
row.setStruct_name(structDao.getStruct_name());
row.setPcsn(DateUtil.today());
this.save(row);
}
}
@Override
public void deleteById(String mst_id) {
this.remove(new QueryWrapper<StIvtIostorinvdisYl>().eq("iostorinv_id", mst_id));
}
@Override
public void deleteById(String mst_id) {
this.remove(new QueryWrapper<StIvtIostorinvdisYl>().eq("iostorinv_id", mst_id));
}
}

View File

@@ -113,5 +113,18 @@ public class StIvtStructivtYl implements Serializable {
*/
private String workshop_id;
/**
* 物料编号
*/
private String material_code;
/**
* aps入库时间
*/
private String aps_instorage_time;
/**
* aps订单种类
*/
private String aps_sale_type;
}