|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.workorder.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
@ -173,6 +174,8 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
if(ogList.size()>0) |
|
|
|
|
{//start if 02
|
|
|
|
|
// 保存工单
|
|
|
|
|
|
|
|
|
|
//获取订单商品
|
|
|
|
|
OrderGoods ogModel=ogList.get(0); |
|
|
|
|
|
|
|
|
|
//服装款式
|
|
|
|
@ -199,6 +202,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
} |
|
|
|
|
ZyClothSample cSampleModel=csList.get(0); |
|
|
|
|
|
|
|
|
|
//生成工单
|
|
|
|
|
int goodNum=ogModel.getGoodsNum(); |
|
|
|
|
WorkOrder workOrder=new WorkOrder(); |
|
|
|
|
workOrder.setProductCode(CreateWorkCode(csModel.getNums(),smModel.getModelNumber()));//工单编号
|
|
|
|
@ -210,8 +214,9 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
workOrder.setWorkOrderStatus(0);//工单状态
|
|
|
|
|
workOrder.setEnterprisesId(depId);//企业id
|
|
|
|
|
baseMapper.insert(workOrder); |
|
|
|
|
|
|
|
|
|
//保存产品
|
|
|
|
|
if(ogModel.getGoodsNum()>0) |
|
|
|
|
if(goodNum>0) |
|
|
|
|
{ |
|
|
|
|
//量体数据
|
|
|
|
|
CustomerMeasure mesureModel=customerMeasureMapper.selectById(ogModel.getMeasureId()); |
|
|
|
@ -219,7 +224,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
return Result.error("未找到对客户量体数据!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//商品数量对应产品
|
|
|
|
|
//#region 商品数量对应产品 保存产品
|
|
|
|
|
for(int i=0;i<goodNum;i++) |
|
|
|
|
{ |
|
|
|
|
ZyProduct productModel=new ZyProduct(); |
|
|
|
@ -312,13 +317,6 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
//zyProductProcessService.save()
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 工具-添加(服装款式类型中读取)
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 设备-添加(服装款式类型中读取)
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 产品模块-添加(从订单中读取)
|
|
|
|
|
//订单商品模块表-根据订单商品id
|
|
|
|
@ -382,7 +380,10 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
// productAccessoriesMapper.saveBatch(productAccessoriesList);
|
|
|
|
|
//#endregion
|
|
|
|
|
} |
|
|
|
|
}else |
|
|
|
|
//#endregion
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return Result.error("订单商品数量小于0!"); |
|
|
|
|
|
|
|
|
@ -405,13 +406,57 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public Result<?> cancellationWorkOrder(WorkOrder woModel) { |
|
|
|
|
//根据工单获取产品列表,然后循环删除产品列表中的工序,以及工序对应的设备、工具,再删除产品中对应模块、面料、辅料
|
|
|
|
|
|
|
|
|
|
//ZyProduct
|
|
|
|
|
//工单
|
|
|
|
|
//-产品
|
|
|
|
|
QueryWrapper<ZyProduct> productWrapper = new QueryWrapper<ZyProduct>(); |
|
|
|
|
productWrapper.eq("work_order_id", woModel.getId()); |
|
|
|
|
List<ZyProduct> productList = productMapper.selectList(productWrapper); |
|
|
|
|
|
|
|
|
|
for (ZyProduct model:productList) |
|
|
|
|
{ |
|
|
|
|
//-工序
|
|
|
|
|
QueryWrapper<ZyProductProcess> productProcessWrapper = new QueryWrapper<ZyProductProcess>(); |
|
|
|
|
productProcessWrapper.eq("product_id",model.getId()); |
|
|
|
|
productProcessMapper.delete(productProcessWrapper); |
|
|
|
|
//-工具
|
|
|
|
|
QueryWrapper<ProductOperationtool> productOperationtoolWrapper = new QueryWrapper<ProductOperationtool>(); |
|
|
|
|
productOperationtoolWrapper.eq("product_id",model.getId()); |
|
|
|
|
productOperationtoolMapper.delete(productOperationtoolWrapper); |
|
|
|
|
//-设备
|
|
|
|
|
QueryWrapper<ProductMachine> productMachineWrapper = new QueryWrapper<ProductMachine>(); |
|
|
|
|
productMachineWrapper.eq("product_id",model.getId()); |
|
|
|
|
productMachineMapper.delete(productMachineWrapper); |
|
|
|
|
|
|
|
|
|
//产品模块
|
|
|
|
|
QueryWrapper<ProductModule> productModuleWrapper = new QueryWrapper<ProductModule>(); |
|
|
|
|
productModuleWrapper.eq("product_id",model.getId()); |
|
|
|
|
productModuleMapper.delete(productModuleWrapper); |
|
|
|
|
|
|
|
|
|
//产品面料
|
|
|
|
|
QueryWrapper<ProductFabric> productFabricWrapper = new QueryWrapper<ProductFabric>(); |
|
|
|
|
productFabricWrapper.eq("product_id",model.getId()); |
|
|
|
|
productFabricMapper.delete(productFabricWrapper); |
|
|
|
|
|
|
|
|
|
//产品面料
|
|
|
|
|
QueryWrapper<ProductAccessories> productAccessoriesWrapper = new QueryWrapper<ProductAccessories>(); |
|
|
|
|
productAccessoriesWrapper.eq("product_id",model.getId()); |
|
|
|
|
productAccessoriesMapper.delete(productAccessoriesWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
//修改订单
|
|
|
|
|
UpdateWrapper updateWrapper = new UpdateWrapper(); |
|
|
|
|
updateWrapper.eq("id", woModel.getOrdersId()); |
|
|
|
|
updateWrapper.set("delivery_status", 2); |
|
|
|
|
int update = zyOrdersMapper.update(null, updateWrapper); |
|
|
|
|
|
|
|
|
|
//产品
|
|
|
|
|
productMapper.delete(productWrapper); |
|
|
|
|
//工单
|
|
|
|
|
baseMapper.deleteById(woModel.getId()); |
|
|
|
|
return Result.OK("成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|