|
@@ -72,6 +72,9 @@ public class TEquipmentApplyController {
|
|
|
@Autowired
|
|
|
AmqpAdmin amqpAdmin;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ TGoodsDataService goodsDataService;
|
|
|
+
|
|
|
@ApiOperation(value = "查找机器审核列表")
|
|
|
@GetMapping("/pageTEquipmentApply")
|
|
|
public ResponseModel<IPage<?>> pageTEquipmentApply(String adminId, String clientId, String userName,String managerId,String statusType, long current, long size ) {
|
|
@@ -286,17 +289,34 @@ public class TEquipmentApplyController {
|
|
|
}
|
|
|
//获取设备的id
|
|
|
Long equipmentId = equipment.getId();
|
|
|
- if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG280")){
|
|
|
- saveProductMG280(equipmentId);
|
|
|
- } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG320-1")){
|
|
|
- saveProductMG1(equipmentId);
|
|
|
- } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("P30")){
|
|
|
- saveProductP30(equipmentId);
|
|
|
- } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("SI320")){
|
|
|
- saveProductSI320(equipmentId);
|
|
|
- } else {
|
|
|
- saveProduct(equipmentId);
|
|
|
+ if (StringUtils.isEmpty(machineType) || machineType.equals("0")) {
|
|
|
+ if (equipmentApply.getEquimentType() != null && equipmentApply.getEquimentType().equals("MG280")) {
|
|
|
+ saveProductMG280(equipmentId);
|
|
|
+ } else if (equipmentApply.getEquimentType() != null && equipmentApply.getEquimentType().equals("MG320-1")) {
|
|
|
+ saveProductMG1(equipmentId);
|
|
|
+ } else {
|
|
|
+ saveProduct(equipmentId);
|
|
|
+ }
|
|
|
+ } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("1")){
|
|
|
+ if (equipmentType.equals("P30")) {
|
|
|
+ saveGoodsData(equipmentId, machineType, 6);
|
|
|
+ }
|
|
|
+ } else if (StringUtils.isNotEmpty(machineType) && machineType.equals("2")){
|
|
|
+ if (equipmentType.equals("SI320")) {
|
|
|
+ saveGoodsData(equipmentId, machineType, 6);
|
|
|
+ }
|
|
|
}
|
|
|
+// if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG280")){
|
|
|
+// saveProductMG280(equipmentId);
|
|
|
+// } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("MG320-1")){
|
|
|
+// saveProductMG1(equipmentId);
|
|
|
+// } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("P30")){
|
|
|
+// saveProductP30(equipmentId);
|
|
|
+// } else if(StringUtils.isNotEmpty(equipmentType) && equipmentType.equals("SI320")){
|
|
|
+// saveProductSI320(equipmentId);
|
|
|
+// } else {
|
|
|
+// saveProduct(equipmentId);
|
|
|
+// }
|
|
|
LambdaQueryWrapper<TEquipment> query1 = Wrappers.lambdaQuery();
|
|
|
query1.eq(TEquipment::getClientId,clientId);
|
|
|
TEquipment tEquipment = equipmentService.getOne(query1);
|
|
@@ -343,6 +363,34 @@ public class TEquipmentApplyController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 添加商品
|
|
|
+ * @param id
|
|
|
+ * @param machineType
|
|
|
+ * @param number
|
|
|
+ */
|
|
|
+ private void saveGoodsData(Long id, String machineType, Integer number) {
|
|
|
+ LambdaQueryWrapper<TGoodsData> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(TGoodsData::getNumber, number);
|
|
|
+ wrapper.eq(TGoodsData::getMachineType, machineType);
|
|
|
+ TGoodsData goodsData = goodsDataService.getOne(wrapper);
|
|
|
+ String goods = goodsData.getGoods();
|
|
|
+ String[] str = goods.split(",");
|
|
|
+
|
|
|
+ for (int i = 0; i < str.length; i++) {
|
|
|
+ TProduct product = new TProduct();
|
|
|
+ product.setCreateDate(new Date());
|
|
|
+ product.setModifyDate(new Date());
|
|
|
+ product.setEquipmentId(id);
|
|
|
+ String[] split = str[i].split("-");
|
|
|
+ product.setProductName(split[0]);
|
|
|
+ product.setNo(split[1]);
|
|
|
+ product.setRmbPrice(new BigDecimal(0.01));
|
|
|
+ product.setCodePrice(new BigDecimal(0.01));
|
|
|
+ productService.save(product);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 添加产品
|
|
|
*
|
|
|
* @param id
|
|
@@ -484,7 +532,12 @@ public class TEquipmentApplyController {
|
|
|
* @param id
|
|
|
*/
|
|
|
private void saveProductSI320(Long id) {
|
|
|
- String[] str = {"雪糕-I01", "果酱(1)-J01", "果酱(2)-J02", "果酱(3)-J03", "果碎(1)-C01", "果碎(2)-C02"};
|
|
|
+ LambdaQueryWrapper<TGoodsData> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(TGoodsData::getNumber, 6);
|
|
|
+ wrapper.eq(TGoodsData::getMachineType, "2");
|
|
|
+ TGoodsData goodsData = goodsDataService.getOne(wrapper);
|
|
|
+ String goods = goodsData.getGoods();
|
|
|
+ String[] str = goods.split(",");
|
|
|
|
|
|
for (int i = 0; i < str.length; i++) {
|
|
|
TProduct product = new TProduct();
|