喻忠伟 2 years ago
commit 21b91a9984
  1. 54
      ant-design-vue-jeecg/src/views/shopping/pages/gerenzhongxin.vue
  2. 35
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/controller/ZyProductPlanController.java
  3. 58
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/IZyProductPlanAutoServiceImpl.java
  4. 44
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java
  5. 14
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyProductPlanServiceImpl.java

@ -196,6 +196,40 @@
</div>
</div>
<password-modal ref="passwordmodal" @ok="passwordModalOk"></password-modal>
<a-modal v-model="visible3" class="toPay">
<template slot="title">
<div class="c_1B f_20" style="text-align: center;padding: 5px;font-weight: 500">支付宝支付</div>
</template>
<div class="d-flex"
style="
width: 450px;
padding: 30px 10px;
margin: 0 auto;">
<div class="l"
style="
width: 120px;
height: 120px;
margin-right: 20px;" @click="zhifu">
<img style="width: 120px;
height: 120px;" src="../assets/erweima.png"/>
</div>
<div class="r" style="width:290px">
<p class="f_16 c_4B">总计: </p>
<p class="f_14 c_4B">请使用支付宝扫描左图二维码进行支付</p>
<p class="f_14 c_4B">请您在15分钟内付款以免订单被取消如有疑问请联系客服</p>
<p class="f_14 c_4B">订单发货后您将收到订单发货通知短信</p>
</div>
</div>
<template slot="footer">
<div class="d-flex" style="justify-content: center;align-items:center">
<a-button style="margin-right: 30px;border:none;font-size: 12px">手机不在身边 登录账号付款</a-button>
<a-button style="font-size: 12px" size="small" @click="handleCancel2">
返回
</a-button>
</div>
</template>
</a-modal>
<Footer></Footer>
</div>
@ -356,6 +390,7 @@
desc: [{ required: true, message: 'Please input activity form', trigger: 'blur' }],*/
},
visible1: false,
visible3: false,
};
},
@ -380,6 +415,9 @@
id: id,
},
});
},
zhifu() {
},
passwordModalOk() {
//TODO datasource
@ -387,6 +425,9 @@
handleCancel(e) {
this.visible1 = false;
},
handleCancel2(e) {
this.visible3 = false;
},
handleChangePassword(username) {
this.$refs.passwordmodal.show(username);
},
@ -488,12 +529,13 @@
});
},
ljzf(item){
this.$router.push({
path: "/shopping/pay",
query: {
id: item.id,
},
});
// this.$router.push({
// path: "/shopping/pay",
// query: {
// id: item.id,
// },
// });
this.visible3 = true
},
menuChange(key){
this.current.shift()

@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.productplan.entity.ZyProductPlan;
@ -35,6 +36,7 @@ import javax.jws.Oneway;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Optional;
/**
* @Description: 生产计划
@ -52,13 +54,9 @@ public class ZyProductPlanController extends JeecgController<ZyProductPlan, IZyP
@Autowired
private IWorkOrderService iWorkOrderService;
// @Autowired
// private IZyProductService iZyProductService;
// @Autowired
// private ISysDepartService iSysDepartService;
//
// @Autowired
// private ISysUserService iSysUserService;
@Autowired
private ISysUserService iSysUserService;
/**
* 分页列表查询
@ -99,20 +97,6 @@ public class ZyProductPlanController extends JeecgController<ZyProductPlan, IZyP
@ApiOperation(value = "生产计划-添加", notes = "生产计划-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ZyProductPlan zyProductPlan) {
// String productCode = zyProductPlan.getProductCode();
// ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, productCode));
// zyProductPlan.setProductNo(StringUtils.isNotBlank(zyProduct.getProductCode()) ? zyProduct.getProductCode() : "");
// zyProductPlan.setProductName(StringUtils.isNotBlank(zyProduct.getProductName()) ? zyProduct.getProductName() : "");
// if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) {
// SysDepart sysDepart = iSysDepartService.getById(zyProduct.getEnterprisesId());
// zyProductPlan.setProductOrg(StringUtils.isNotBlank(sysDepart.getDepartName()) ? sysDepart.getDepartName() : "");
// }
// SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getRealname, zyProductPlan.getTeamLeader()));
// zyProductPlan.setTeamLeader(sysUser.getUsername());
// zyProductPlanService.save(zyProductPlan);
//
// //更新work_order表work_order_status为“1” (不能为其新增生产计划)
// iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update();
zyProductPlanService.create(zyProductPlan);
return Result.OK("添加成功!");
}
@ -127,6 +111,8 @@ public class ZyProductPlanController extends JeecgController<ZyProductPlan, IZyP
@ApiOperation(value = "生产计划-编辑", notes = "生产计划-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyProductPlan zyProductPlan) {
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getRealname, zyProductPlan.getTeamLeader()));
zyProductPlan.setTeamLeader(sysUser.getUsername());
zyProductPlanService.updateById(zyProductPlan);
return Result.OK("编辑成功!");
}
@ -141,9 +127,14 @@ public class ZyProductPlanController extends JeecgController<ZyProductPlan, IZyP
@ApiOperation(value = "生产计划-通过id删除", notes = "生产计划-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
ZyProductPlan zyProductPlan = zyProductPlanService.getById(id);
Optional.ofNullable(zyProductPlan).orElseThrow(() -> new JeecgBootException("生产计划不存在"));
zyProductPlanService.removeById(id);
//更新work_order表work_order_status为“0” (可以为其新增生产计划)
iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode()).update();
iWorkOrderService.lambdaUpdate()
.set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode())
.eq(WorkOrder::getProductCode, zyProductPlan.getProductCode())
.update();
return Result.OK("删除成功!");
}

@ -88,20 +88,22 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST;
Set<String> zyProductPlanProductCodes = new LinkedHashSet<>();
Set<String> zyProductPlanProductNos = new LinkedHashSet<>();
List<SysDepart> sysDepartList = iSysDepartService.list(new LambdaQueryWrapper<SysDepart>().eq(SysDepart::getOrgCategory, "2"));
List<SysDepart> sysDepartList2 = this.copyList(workOrderList, sysDepartList);
AtomicInteger i = new AtomicInteger(0);
workOrderList.stream().forEach(e -> {
String productCode = e.getProductCode();
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>()
.eq(ZyProduct::getWorkOrderId, productCode));
Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在"));
//工单id
String workOrderId = e.getId();
//一个工单对应一个产品
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrderId));
if (!ObjectUtils.isEmpty(zyProduct)) {
//2,保存生产计划
ZyProductPlan zyProductPlan = new ZyProductPlan();
zyProductPlan.setProductCode(productCode);
//工单编号
zyProductPlan.setProductCode(e.getProductCode());
//产品编号
zyProductPlan.setProductNo(zyProduct.getProductCode());
zyProductPlan.setProductName(zyProduct.getProductName());
@ -146,15 +148,19 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
iZyProductPlanService.save(zyProductPlan);
//更新work_order表work_order_status为“1” (不能为其新增生产计划)
iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update();
iWorkOrderService.lambdaUpdate()
.set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode())
.eq(WorkOrder::getProductCode, zyProductPlan.getProductCode())
.update();
zyProductPlanProductNos.add(zyProduct.getProductCode());
}
zyProductPlanProductCodes.add(productCode);
});
//根据productCode,查询本次创建生产计划
//根据产品编号,查询本次创建成功的生产计划
List<ZyProductPlan> productPlanList = iZyProductPlanService.list(new LambdaQueryWrapper<ZyProductPlan>()
.eq(ZyProductPlan::getStatus, ProductPlanStatusEnum.UNAUDITED.getCode())
.in(ZyProductPlan::getStatus, zyProductPlanProductCodes));
.in(ZyProductPlan::getProductNo, zyProductPlanProductNos));
return productPlanList;
}
@ -168,20 +174,21 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
List<ZyProductPlan> saveProductPlan4Mock(List<WorkOrder> workOrderList) {
if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST;
Set<String> zyProductPlanProductCodes = new LinkedHashSet<>();
Set<String> zyProductPlanProductNos = new LinkedHashSet<>();
/**
* 模拟测试 车间负责人班组组长使用固定值
*/
workOrderList.stream().forEach(e -> {
String productCode = e.getProductCode();
// 工单编号
String productCode = e.getId();
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>()
.eq(ZyProduct::getWorkOrderId, productCode));
Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在"));
.eq(ZyProduct::getWorkOrderId, productCode)
);
if (!ObjectUtils.isEmpty(zyProduct)) {
//2,保存生产计划
ZyProductPlan zyProductPlan = new ZyProductPlan();
zyProductPlan.setProductCode(productCode);
zyProductPlan.setProductCode(e.getProductCode());
zyProductPlan.setProductNo(zyProduct.getProductCode());
zyProductPlan.setProductName(zyProduct.getProductName());
@ -196,7 +203,8 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
SysDepart sysDepart = iSysDepartService.getOne(new LambdaQueryWrapper<SysDepart>()
.eq(SysDepart::getOrgCategory, "2")
.eq(SysDepart::getDepartName, "测试生产企业"));
if (ObjectUtils.isEmpty(sysDepart)) throw new JeecgBootException("生产计划自动化-mock-[企业信息]数据异常!");
if (ObjectUtils.isEmpty(sysDepart))
throw new JeecgBootException("生产计划自动化-mock-[企业信息]数据异常!");
//车间
zyProductPlan.setWorkshopId(sysDepart.getId());
@ -225,15 +233,19 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
iZyProductPlanService.save(zyProductPlan);
//更新work_order表work_order_status为“1” (不能为其新增生产计划)
iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update();
iWorkOrderService.lambdaUpdate()
.set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode())
.eq(WorkOrder::getProductCode, zyProductPlan.getProductCode())
.update();
zyProductPlanProductCodes.add(productCode);
zyProductPlanProductNos.add(zyProduct.getProductCode());
}
});
//根据productCode,查询本次创建生产计划
List<ZyProductPlan> productPlanList = iZyProductPlanService.list(new LambdaQueryWrapper<ZyProductPlan>()
.eq(ZyProductPlan::getStatus, ProductPlanStatusEnum.UNAUDITED.getCode())
.in(ZyProductPlan::getStatus, zyProductPlanProductCodes));
.eq(ZyProductPlan::getProductNo, zyProductPlanProductNos));
return productPlanList;
}
@ -270,9 +282,9 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp
if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST;
//2,保存生产计划
// List<ZyProductPlan> productPlanList = this.saveProductPlan(workOrderList);
List<ZyProductPlan> productPlanList = this.saveProductPlan(workOrderList);
//TODO
List<ZyProductPlan> productPlanList = this.saveProductPlan4Mock(workOrderList);
// List<ZyProductPlan> productPlanList = this.saveProductPlan4Mock(workOrderList);
if (ObjectUtils.isEmpty(productPlanList)) return Collections.EMPTY_LIST;
//3,同步计划生产工序、同步生产计划工序面料、同步生产计划辅料

@ -170,10 +170,14 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
throw new JeecgBootException("生产计划不存在!");
}
//工单id
String workOrderId = zyProductPlan.getProductCode();
//工单编号
String productCode = zyProductPlan.getProductCode();
WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper<WorkOrder>().eq(WorkOrder::getProductCode, productCode));
if (ObjectUtils.isEmpty(workOrder)) {
throw new JeecgBootException("工单不存在!");
}
String departId = zyProductPlan.getWorkshopId();
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrderId));
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrder.getId()));
if (ObjectUtils.isEmpty(zyProduct)) {
throw new JeecgBootException("产品不存在!");
}
@ -192,7 +196,13 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
});
}
Groupx groupx = iGroupxService.getOne(new LambdaQueryWrapper<Groupx>().eq(Groupx::getDepartId, departId).eq(Groupx::getId, zyProductPlan.getTeamId()));
if (ObjectUtils.isEmpty(groupx)) {
throw new JeecgBootException("班组不存在!");
}
List<GroupxMember> groupMembers = iGroupxMemberService.list(new LambdaQueryWrapper<GroupxMember>().eq(GroupxMember::getGroupxId, groupx.getId()));
if (ObjectUtils.isEmpty(groupMembers)) {
throw new JeecgBootException("班组成员不存在!");
}
List<GroupxMemeberVo> groupxMemeberVoList = new LinkedList<>();
if (!ObjectUtils.isEmpty(groupMembers)) {
@ -323,7 +333,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
throw new JeecgBootException(zyProductPlan.getId() + "生产计划不存在");
}
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>()
.eq(ZyProduct::getWorkOrderId, zyProductPlan.getProductCode())
// .eq(ZyProduct::getWorkOrderId, zyProductPlan.getProductCode())
.eq(ZyProduct::getProductCode, zyProductPlan.getProductNo()));
if (ObjectUtils.isEmpty(zyProduct)) {
throw new JeecgBootException(zyProductPlan.getProductNo() + "产品不存在");
@ -479,19 +489,17 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
if (ObjectUtils.isEmpty(zyProductPlan)) {
throw new JeecgBootException("生产计划不存在!");
}
//工单id
String workOrderId = zyProductPlan.getProductCode();
//工单编号
String productCode = zyProductPlan.getProductCode();
WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper<WorkOrder>().eq(WorkOrder::getProductCode, productCode));
if (ObjectUtils.isEmpty(workOrder)) {
throw new JeecgBootException("工单不存在!");
}
String departId = zyProductPlan.getWorkshopId();
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrderId));
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrder.getId()));
if (ObjectUtils.isEmpty(zyProduct)) {
throw new JeecgBootException("产品不存在!");
}
// 工单信息
WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper<WorkOrder>().eq(WorkOrder::getProductCode, zyProductPlan.getProductCode()));
if (ObjectUtils.isEmpty(workOrder))
throw new JeecgBootException(zyProductPlan.getProductCode() + "工单信息不存在");
String ordersId = workOrder.getOrdersId();
//订单信息
OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrdersId, ordersId));
@ -501,13 +509,19 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
if (ObjectUtils.isEmpty(zyOrders)) throw new JeecgBootException(ordersId + "订单信息不存在");
Map<String, Object> result = new HashMap<>();
result.put("productCode", zyProduct.getProductCode());
result.put("productCode", zyProductPlan.getProductCode());
result.put("productName", zyProduct.getProductName());
result.put("productOrg", zyProductPlan.getProductOrg());
result.put("productName", zyProductPlan.getProductName());
result.put("productNo", zyProductPlan.getProductNo());
result.put("productNo", zyProduct.getProductCode());
SysDepart depart = iSysDepartService.getById(departId);
if (ObjectUtils.isEmpty(depart)) {
throw new JeecgBootException("部门不存在!");
}
Groupx groupx = iGroupxService.getById(zyProductPlan.getTeamId());
if (ObjectUtils.isEmpty(groupx)) {
throw new JeecgBootException("班组不存在!");
}
result.put("workshop", depart.getDepartName());
result.put("team", groupx.getGroupName());
result.put("teamLade", iSysUserService.getById(groupx.getEnterprisesManager()).getRealname());

@ -20,6 +20,7 @@ import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.team.entity.Groupx;
import org.jeecg.modules.team.entity.Station;
import org.jeecg.modules.team.service.IGroupxService;
import org.jeecg.modules.workorder.entity.WorkOrder;
import org.jeecg.modules.workorder.enums.WorkOrderStatusEnum;
@ -33,6 +34,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
@ -123,9 +125,12 @@ public class ZyProductPlanServiceImpl extends ServiceImpl<ZyProductPlanMapper, Z
@Override
public void create(ZyProductPlan zyProductPlan) {
//工单编号
String productCode = zyProductPlan.getProductCode();
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, productCode));
Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":产品不存在"));
WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper<WorkOrder>().eq(WorkOrder::getProductCode, productCode));
Optional.ofNullable(workOrder).orElseThrow(() -> new JeecgBootException(productCode + ":工单编号不存在"));
ZyProduct zyProduct = iZyProductService.getOne(new LambdaQueryWrapper<ZyProduct>().eq(ZyProduct::getWorkOrderId, workOrder.getId()));
Optional.ofNullable(zyProduct).orElseThrow(() -> new JeecgBootException(productCode + ":工单对应的产品不存在"));
zyProductPlan.setProductNo(StringUtils.isNotBlank(zyProduct.getProductCode()) ? zyProduct.getProductCode() : "");
zyProductPlan.setProductName(StringUtils.isNotBlank(zyProduct.getProductName()) ? zyProduct.getProductName() : "");
if (StringUtils.isNotBlank(zyProduct.getEnterprisesId())) {
@ -138,6 +143,9 @@ public class ZyProductPlanServiceImpl extends ServiceImpl<ZyProductPlanMapper, Z
this.save(zyProductPlan);
//更新work_order表work_order_status为“1” (不能为其新增生产计划)
iWorkOrderService.lambdaUpdate().set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode()).update();
iWorkOrderService.lambdaUpdate()
.set(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.REVIEWED.getCode())
.eq(WorkOrder::getId, workOrder.getId())
.update();
}
}

Loading…
Cancel
Save