提交 b1c551f5 authored 作者: 许俊's avatar 许俊

修改排产计划,从生产汇报单据获得数据改成从生产订单获取数据

上级 f108ca55
package org.jeecg.modules.iost.API.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONObject;
......@@ -171,11 +172,12 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
/*明细实体类信息保存*/
public void pojosave(Map<String, String> stringStringMap, ArrayList<Productionscheduling> productionschedulings) {
Productionscheduling p = new Productionscheduling();
p.setPurchaserhqcode(stringStringMap.get("purchaserhqcode"));
/* Productionscheduling p = new Productionscheduling();*/
Productionscheduling productionscheduling = JSON.parseObject(JSON.toJSONString(stringStringMap), Productionscheduling.class);//map转为实体类对象
/* p.setPurchaserhqcode(stringStringMap.get("purchaserhqcode"));
p.setSuppliercode(stringStringMap.get("suppliercode"));
p.setSuppliername(stringStringMap.get("suppliername"));
/* p.setPoitemid(Integer.valueOf(stringStringMap.get("poitemid")));*/
p.setPoitemid(Integer.valueOf(stringStringMap.get("poItemId")));
p.setSchedulecode(stringStringMap.get("schedulecode"));
p.setProvcocode(stringStringMap.get("provcocode"));
p.setProvconame(stringStringMap.get("provconame"));
......@@ -194,7 +196,7 @@ public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSched
p.setDatasourcecreatetime(stringStringMap.get("datasourcecreatetime"));
p.setOwnerid(stringStringMap.get("ownerid"));
p.setOpenid(stringStringMap.get("openid"));
p.setFid(stringStringMap.get("fid"));
productionschedulings.add(p);
p.setFid(stringStringMap.get("fid"));*/
productionschedulings.add(productionscheduling);
}
}
......@@ -7,10 +7,12 @@ import org.jeecg.modules.iost.API.Dao.CategoryDao;
import org.jeecg.modules.iost.API.ExternalInterface.PurchaseorderApi;
import org.jeecg.modules.iost.API.Util.JsonUtil;
import org.jeecg.modules.iost.API.entity.Purchaseorder;
import org.jeecg.modules.iost.API.entity.pojo.Salesorder;
import org.jeecg.modules.iost.API.service.IPurchaseorderService;
import org.jeecg.modules.iost.API.webapi.Interface.web_api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.io.IOException;
import java.util.*;
......@@ -29,13 +31,20 @@ public class ProductionSchedulingWebapi implements web_api {
@Autowired
private IPurchaseorderService purchaseorderService;
/**操作的单据体名称*/
private String sFormId = "PRD_MORPT";
private String sFormId = "PRD_MO";
private Map<String,String> key = new LinkedHashMap<>();
public ProductionSchedulingWebapi()
{
key.put("FCreateDate","FCreateDate");// 创建日期 index 0
key.put("FID","FID");//主键 index 1
key.put("FMoId ","FMoId ");//生产订单内码 index 2
key.put("FSaleOrderId", "FSaleOrderId"); //销售订单id index 2
key.put("FBILLNO","FBILLNO");//单据编码 index 3
key.put("FMemoItem","FMemoItem");//备注 index 4
key.put("FPlanStartDate","FPlanStartDate");// 计划开工时间 index 5
key.put("FPlanFinishDate","FPlanFinishDate");// 计划完工时间 index 6
key.put("FStartDate","FStartDate");// 开工日期 index 7
key.put("FFinishDate","FFinishDate");// 完工日期 index 8
}
......@@ -80,44 +89,37 @@ public class ProductionSchedulingWebapi implements web_api {
*/
public List<Map<String,String>> ProductionScheduling(List<List<Object>> list){
List<Map<String,String>> ProductionSchedulinglist = new ArrayList<>();
if(!list.isEmpty()) {
Map<String, String> fid = new IdentityHashMap<String, String>();
for (List<Object> list1 : list) {//获取生产订单id 拼接查询条件
fid.put(new String("fid = "), list1.get(2).toString());
}
List<List<Object>> FSaleOrderIds = productionOrderWebapi.selectOr(fid);//查询关联生产订单
List<List<Object>> f=new ArrayList<>();
List<List<Object>> l=new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
String s = list.get(i).get(2).toString();
label:for (int j = 0; j < FSaleOrderIds.size(); j++) {
if (s.equals(FSaleOrderIds.get(j).get(1).toString())) {
f.add(list.get(i));
l.add(FSaleOrderIds.get(j));
FSaleOrderIds.remove(j);
break label;
}
if(!ObjectUtils.isEmpty(list)) {
List<List<Object>> needSynLists=new ArrayList<>(); //需要转换同步的数据
for (List<Object> objects : list) {
Object o = objects.get(2);//返回的list里面的销售订单id
//查看生产订单返回的销售订单Fid(销售订单Fid=采购订单Fid)是否在采购订单存在,存在说明此生产订单是由采购订单推下来的
QueryWrapper<Purchaseorder> qw=new QueryWrapper<>();
qw.eq("F_Id",String.valueOf(o));
Integer integer = purchaseorderService.getBaseMapper().selectCount(qw);
if(!integer.equals(0))
{
needSynLists.add(objects);
}
}
int i=0;
for (List<Object> list1 : f) {
for (List<Object> list1 : needSynLists) {
Map<String, String> ProductionSchedulingmap = new HashMap<>();
QueryWrapper<Purchaseorder> queryWrapper = new QueryWrapper<>();
queryWrapper.select("F_Id");
Object SaleOrderId = l.get(i++).get(0);//销售订单id,可匹配过滤是否平台生成订单获取采购订单行项目号
queryWrapper.eq("F_Id", SaleOrderId.toString());
//查询是否为集成平台生成的订单,并过滤
Purchaseorder purchaseorders1 = purchaseorderService.getBaseMapper().selectOne(queryWrapper);
if (purchaseorders1==null) continue;
ProductionSchedulingmap.put("poItemId",purchaseorders1.getPoItemId());//采购订单行项目id
Object need = list1.get(2);//返回的list里面的销售订单id
QueryWrapper<Purchaseorder> qw=new QueryWrapper<>();
qw.eq("F_Id",String.valueOf(need));
qw.select("po_Item_Id");
Purchaseorder purchaseorder = purchaseorderService.getBaseMapper().selectOne(qw);
ProductionSchedulingmap.put("poitemid",purchaseorder.getPoItemId());//采购订单行项目id
ProductionSchedulingmap.put("datasource", "0");//数据来源(固定写成0)
ProductionSchedulingmap.put("purchaserhqcode", "SGCC"); //采购方总部编码 SGCC
ProductionSchedulingmap.put("datasourcecreatetime", SubStringT(list1.get(0).toString())); //来源数据创建时间
ProductionSchedulingmap.put("fid", list1.get(1).toString());//实体主键 ,设置了后不能重复插入
ProductionSchedulingmap.put("schedulecode", list1.get(3).toString());//排产计划编码
ProductionSchedulingmap.put("remark", list1.get(4).toString());//备注
ProductionSchedulingmap.put("planstartdate", list1.get(5).toString());//计划开始日期
ProductionSchedulingmap.put("planfinishdate", list1.get(6).toString());//计划完成日期
ProductionSchedulingmap.put("actualstartdate", list1.get(7).toString());//实际开始日期
ProductionSchedulingmap.put("actualfinishdate", list1.get(8).toString());//实际完成日期
ProductionSchedulinglist.add(ProductionSchedulingmap);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论