rev:表单同步;add:手持单据出库

This commit is contained in:
zhangzq
2024-11-18 10:58:20 +08:00
parent 15951b0341
commit fb38bc1556
11 changed files with 362 additions and 109 deletions

View File

@@ -1,17 +1,17 @@
##货位分配原则 出入库
###1、上轻下重原则
根据货物重量选择摆放位置。把重的东西放在下层,把轻放在货架上层。需要人工搬运的大型货物以腰部的高度摆放。这样提高效率、保证安全。
###2、优先靠近出入口原则
根据出入库频率选定位置。出入库频率高的货物应放在靠近出入口,易于作业的地方;流动性差的货物放在离出入口较远的地方;季节性物品按季节特性来选定场所摆放。
###3、先进先出原则
一般企业为了加快周转,先入先出一同种物料出库时,先入库的物资,需要先提取出库,以加快物料周转,从而避免因物料长期积压产生锈蚀、变形、变质及其他损坏造成的损失。因此在货位分配时要方便先进物品优先出库。
###4、同类物品集中原则
同一品种同一地方保管。为提高作业效率和保管效率同一物品或类似物品应在同一地方保管,提高仓储工作效率。
###5、多巷道分布原则
货位分配是应提高可靠性,分巷道存放一仓库有多个巷道时,同种物品分散在不同的巷道进行存放。以防止因某巷道堵塞影响某种物料的出库,造成生产中断。
###6.超限分配原则:
对于货位超限:横向/纵向暂用多个货位.高度超限
###1、上轻下重原则
根据货物重量选择摆放位置。把重的东西放在下层,把轻放在货架上层。需要人工搬运的大型货物以腰部的高度摆放。这样提高效率、保证安全。
###2、优先靠近出入口原则
根据出入库频率选定位置。出入库频率高的货物应放在靠近出入口,易于作业的地方;流动性差的货物放在离出入口较远的地方;季节性物品按季节特性来选定场所摆放。
###3、先进先出原则
一般企业为了加快周转,先入先出一同种物料出库时,先入库的物资,需要先提取出库,以加快物料周转,从而避免因物料长期积压产生锈蚀、变形、变质及其他损坏造成的损失。因此在货位分配时要方便先进物品优先出库。
###4、同类物品集中原则
同一品种同一地方保管。为提高作业效率和保管效率同一物品或类似物品应在同一地方保管,提高仓储工作效率。
###5、多巷道分布原则
货位分配是应提高可靠性,分巷道存放一仓库有多个巷道时,同种物品分散在不同的巷道进行存放。以防止因某巷道堵塞影响某种物料的出库,造成生产中断。
###6.超限分配原则:
对于货位超限:横向/纵向暂用多个货位.高度超限
##规则处理方式:责任链模式
list->5

View File

@@ -2,8 +2,8 @@ package org.nl.wms.external_system.erp;
import com.alibaba.fastjson.JSON;
import com.kingdee.bos.webapi.entity.*;
import com.kingdee.bos.webapi.sdk.K3CloudApi;
//import com.kingdee.bos.webapi.entity.*;
//import com.kingdee.bos.webapi.sdk.K3CloudApi;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.wms.external_system.erp.dto.ErpQuery;
@@ -44,48 +44,48 @@ public class SyncErpService {
public List<Object> syncData(SyncFormMapping syncFormMapping) {
List<Object> result = new ArrayList<>();
try {
log.info("开始同步ERP" + syncFormMapping.getForm_name());
IdentifyInfo identifyInfo = new IdentifyInfo();
BeanUtils.copyProperties(erpSec, identifyInfo);
K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
String filterString = "FCreateDate >= '" + today + " 00:00:00' and FCreateDate <= '" + today + " 23:59:59'";
ErpQuery query = new ErpQuery();
query.setFilterString(filterString);
//query.setFormId(syncFormMapping.getForm_type());
query.setFormId("PRD_INSTOCK");
query.setFieldKeys("FID");
query.setLimit(2000);
String jsonString = JSON.toJSONString(query);
List<List<Object>> lists = cloudApi.executeBillQuery(jsonString);
log.info("同步ERP结果" + lists.size());
Set<String> ids = new HashSet<>();
for (List<Object> list : lists) {
for (Object r : list) {
String fid = r.toString();
if (StringUtils.isEmpty(fid)) {
throw new RuntimeException("单据同步失败,没有找到FID");
}
ids.add(fid);
}
}
OperateParam param = new OperateParam();
Map<String, String> error = new HashMap<>();
for (String id : ids) {
param.setId(id);
OperatorResult view = cloudApi.view("PRD_INSTOCK", param);
RepoStatus status = view.getResult().getResponseStatus();
if (status.isIsSuccess()) {
result.add(view.getResult().getResult());
} else {
ArrayList<RepoError> errors = status.getErrors();
String errorMsg = errors.stream().map(RepoError::getMessage).collect(Collectors.joining(","));
error.put(id, errorMsg);
}
}
if (!CollectionUtils.isEmpty(error)){
log.info("ERP单据同步同步失败:{}", error);
}
// log.info("开始同步ERP" + syncFormMapping.getForm_name());
// IdentifyInfo identifyInfo = new IdentifyInfo();
// BeanUtils.copyProperties(erpSec, identifyInfo);
// K3CloudApi cloudApi = new K3CloudApi(identifyInfo);
// String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
// String filterString = "FCreateDate >= '" + today + " 00:00:00' and FCreateDate <= '" + today + " 23:59:59'";
// ErpQuery query = new ErpQuery();
// query.setFilterString(filterString);
// //query.setFormId(syncFormMapping.getForm_type());
// query.setFormId("PRD_INSTOCK");
// query.setFieldKeys("FID");
// query.setLimit(2000);
// String jsonString = JSON.toJSONString(query);
// List<List<Object>> lists = cloudApi.executeBillQuery(jsonString);
// log.info("同步ERP结果" + lists.size());
// Set<String> ids = new HashSet<>();
// for (List<Object> list : lists) {
// for (Object r : list) {
// String fid = r.toString();
// if (StringUtils.isEmpty(fid)) {
// throw new RuntimeException("单据同步失败,没有找到FID");
// }
// ids.add(fid);
// }
// }
// OperateParam param = new OperateParam();
// Map<String, String> error = new HashMap<>();
// for (String id : ids) {
// param.setId(id);
// OperatorResult view = cloudApi.view("PRD_INSTOCK", param);
// RepoStatus status = view.getResult().getResponseStatus();
// if (status.isIsSuccess()) {
// result.add(view.getResult().getResult());
// } else {
// ArrayList<RepoError> errors = status.getErrors();
// String errorMsg = errors.stream().map(RepoError::getMessage).collect(Collectors.joining(","));
// error.put(id, errorMsg);
// }
// }
// if (!CollectionUtils.isEmpty(error)){
// log.info("ERP单据同步同步失败:{}", error);
// }
}catch (Exception ex){
ex.printStackTrace();
throw new RuntimeException("同步失败:"+ex.getMessage());

View File

@@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2024-03-28
*/
@RestController
@RequestMapping("api/group")
@RequestMapping("api/groupOrder")
public class GroupOrderController {
@Autowired
@@ -40,10 +40,10 @@ public class GroupOrderController {
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
@PostMapping("maters")
@PostMapping("order")
@SaIgnore
@Log("物料列表")
public ResponseEntity<TableDataInfo<MdMeMaterialbase>> inStorage(@RequestBody PdaMaterQuery query) {
@Log("扫合格证获取单据信息")
public ResponseEntity<TableDataInfo<MdMeMaterialbase>> queryOrder(@RequestBody PdaMaterQuery query) {
PageQuery pageQuery = new PageQuery();
pageQuery.setPage(query.getPage());
pageQuery.setSize(query.getSize());
@@ -55,7 +55,7 @@ public class GroupOrderController {
@PostMapping("in")
@SaIgnore
@Log("手持物料组盘操作")
@Log("手持组盘操作")
public ResponseEntity<Object> inStorage(@RequestBody MaterGroupDto form) {
Assert.noNullElements(new Object[]{form,form.getItem(),form.getStor_code()},"请求参数不能为空");
for (MaterItem item : form.getItem()) {

View File

@@ -2,24 +2,16 @@ package org.nl.wms.pda_manage.iostorage;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.entity.PageQuery;
import org.nl.common.domain.exception.BadRequestException;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.config_manage.form_struc.service.IBmFormStrucService;
import org.nl.wms.config_manage.form_struc.service.dao.BmFormStruc;
import org.nl.wms.flow_manage.flow.service.execution.IActRuExecutionService;
import org.nl.wms.flow_manage.flow.service.execution.dao.ActRuExecution;
import org.nl.wms.md_manage.vehicleMater.service.IMdPbVehicleMaterService;
import org.nl.wms.md_manage.vehicleMater.service.dao.MdPbVehicleMater;
import org.nl.wms.pda_manage.iostorage.server.dto.PdaFormOutStorageDto;
import org.nl.wms.pda_manage.iostorage.server.dto.PdaFormOutMst;
import org.nl.wms.pda_manage.palletio.service.dto.LabelValueVo;
import org.nl.wms.pm_manage.form_data.service.IPmFormDataService;
import org.nl.wms.pm_manage.form_data.service.dto.FormDataQuery;
@@ -41,8 +33,9 @@ import java.util.List;
* @since 2024-03-28
*/
@RestController
@RequestMapping("api/outStorage")
public class OutStorageController {
@RequestMapping("api/pda/outStorage")
@SaIgnore
public class PdaOutController {
@Autowired
private IMdPbVehicleMaterService iMdPbVehicleMaterService;
@@ -53,12 +46,13 @@ public class OutStorageController {
@Autowired
private IPmFormDataService iPmFormDataService;
@GetMapping("order/{type}")
@GetMapping("order")
@Log("出库单据列表")
public ResponseEntity<List<LabelValueVo>> orderType(@PathVariable String type) {
@SaIgnore
public ResponseEntity<List<LabelValueVo>> orderType() {
List<LabelValueVo> result = new ArrayList<>();
List<BmFormStruc> list = iBmFormStrucService.list(new QueryWrapper<BmFormStruc>()
.eq("form_desc", type)
.likeRight("form_desc","出库")
.select("form_type","form_name"));
for (BmFormStruc formStruc : list) {
result.add(new LabelValueVo(formStruc.getForm_name(), formStruc.getForm_type()));
@@ -67,13 +61,16 @@ public class OutStorageController {
}
@GetMapping("orderList")
@Log("查询数据")
@Log("查询单据数据")
@SaIgnore
public ResponseEntity<TableDataInfo<PmFormDataDto>> orderList(FormDataQuery query, PageQuery page) {
query.setStatus(new String[]{StatusEnum.FORM_STATUS.code("生成"),StatusEnum.FORM_STATUS.code("执行中")});
return new ResponseEntity<>(TableDataInfo.build(iPmFormDataService.queryTree(query,page)), HttpStatus.OK);
}
@PostMapping("confirm")
@Log("查询数据")
public ResponseEntity<TableDataInfo> confirm(@RequestBody PdaFormOutStorageDto pdaFormOutStorageDto) {
@Log("出库确认")
@SaIgnore
public ResponseEntity<TableDataInfo> confirm(@RequestBody PdaFormOutMst pdaFormOutMst) {
return new ResponseEntity<>(TableDataInfo.build(), HttpStatus.OK);
}

View File

@@ -0,0 +1,128 @@
package org.nl.wms.pda_manage.iostorage.server.dto;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.math.BigDecimal;
/**
* 出库明细信息
*/
@Data
public class PdaFormOutDtl {
private static final long serialVersionUID = 1L;
/**
* 业务单据单据id
*/
private String id;
/**
* 单据编码
*/
private String code;
/**
* 对应流程实例id
*/
private String proc_inst_id;
/**
* 业务单据编号
*/
private String source_form_id;
/**
* 业务单据编号
*/
private String source_form_type;
/**
* 业务单据日期
*/
private String source_form_date;
/**
* 单据类型
*/
private String form_type;
/**
* 业务单据状态
*/
private String status;
/**
* 业务单据状态
*/
private String remark;
/**
* 创建id
*/
private String create_time;
/**
* 创建id
*/
private String create_name;
/**
* 物料id
*/
private String material_id;
/**
* 物料name
*/
private String material_name;
/**
* 物料code
*/
private String material_code;
/**
* 物料spec
*/
private String material_spec;
/**
* 物料单重
*/
private String single_weight;
/**
* 数量
*/
private BigDecimal qty;
/**
* 已经分配数量
*/
private BigDecimal assign_qty;
/**
* 分配数量
*/
private BigDecimal now_assign_qty = assign_qty;
/**
* 数量
*/
private String unit_id;
/**
* 批次号
*/
private String pcsn;
/**
* 载具
*/
private String vehicle_code;
/**
* 载具组盘id
*/
private String vehicle_id;
/**
* 自定义表单字段
*/
private JSONObject form_data;
/**
* 关联上级表单id
*/
private String parent_id;
}

View File

@@ -0,0 +1,144 @@
package org.nl.wms.pda_manage.iostorage.server.dto;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
* 表单信息表
* </p>
*
* @author generator
* @since 2024-03-25
*/
@Data
public class PdaFormOutMst implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 业务单据单据id
*/
private String id;
/**
* 单据编码
*/
private String code;
/**
* 对应流程实例id
*/
private String proc_inst_id;
/**
* 业务单据编号
*/
private String source_form_id;
/**
* 业务单据编号
*/
private String source_form_type;
/**
* 业务单据日期
*/
private String source_form_date;
/**
* 单据类型
*/
private String form_type;
/**
* 业务单据状态
*/
private String status;
/**
* 业务单据状态
*/
private String remark;
/**
* 创建id
*/
private String create_time;
/**
* 创建id
*/
private String create_name;
/**
* 物料id
*/
private String material_id;
/**
* 物料name
*/
private String material_name;
/**
* 物料code
*/
private String material_code;
/**
* 物料spec
*/
private String material_spec;
/**
* 物料单重
*/
private String single_weight;
/**
* 数量
*/
private BigDecimal qty;
/**
* 分配数量
*/
private BigDecimal assign_qty;
/**
* 数量
*/
private String unit_id;
/**
* 批次号
*/
private String pcsn;
/**
* 载具
*/
private String vehicle_code;
/**
* 载具组盘id
*/
private String vehicle_id;
/**
* 自定义表单字段
*/
private JSONObject form_data;
/**
* 关联上级表单id
*/
private String parent_id;
private Boolean HasChildren=Boolean.FALSE;
private List<PdaFormOutDtl> children;
public void setChildren(List<PdaFormOutDtl> children) {
if (!CollectionUtils.isEmpty(children)){
this.HasChildren=Boolean.TRUE;
}
this.children = children;
}
}

View File

@@ -1,28 +0,0 @@
package org.nl.wms.pda_manage.iostorage.server.dto;
import lombok.Data;
import org.nl.wms.pm_manage.form_data.service.dto.PmFormDataDto;
/**
* 数组参数
*/
@Data
public class PdaFormOutStorageDto {
/**
* 单据明细
*/
private PmFormDataDto pmFormDataDto;
/**
* 车间
*/
private String product_area;
/**
* 仓库编码
*/
private String stor_code;
/**
* 是否齐套出库
*/
private Boolean need_intact;
}

View File

@@ -82,6 +82,12 @@
<if test="query.form_type != null and query.form_type != ''">
and form_type = #{query.form_type}
</if>
<if test="query.status != null and query.status != ''">
and pm_form_data.status IN
<foreach collection="query.status" item="status" separator="," open="(" close=")">
#{status}
</foreach>
</if>
<if test="query.parent_id != null and query.parent_id != ''">
and parent_id = #{query.parent_id}
</if>

View File

@@ -15,5 +15,6 @@ public class FormDataQuery extends BaseQuery<PmFormData> {
private String form_type;
private String parent_id;
private String[] status;
private Map<String,String> form_query;
}

View File

@@ -79,8 +79,13 @@ public class PmFormDataServiceImpl extends ServiceImpl<PmFormDataMapper, PmFormD
}
List<PmFormData> result = new ArrayList<>();
Boolean dtlSplit = formMapping.getDtl_split();
JSONObject sourceData = JSONObject.parseObject(sourceString).getJSONObject("Model");
//直接取
JSONObject sourceData = JSONObject.parseObject(sourceString);;
// if (StringUtils.isNotEmpty(convertJson)){
// sourceData = JSONObject.parseObject(sourceString).getJSONObject("Model");
// }else {
// sourceData = JSONObject.parseObject(sourceString);
// }
if (!dtlSplit){
List<JSONObject> items_arr = mappingParseList(formMapping.getMapping_json(), one, sourceData);
for (int i = 0; i < items_arr.size(); i++) {

View File

@@ -24,7 +24,7 @@
v-for="item in fromTypes"
:key="item.value"
:value="item.value"
:label="item.label"
:label="item.lable"
/>
</el-select>
</el-form-item>