fix erp and 供应链大屏

plp
chenshuichuan 1 year ago
parent 6988a9b7c2
commit 0950f5f4a2

@ -232,10 +232,10 @@ public class ErpSaleOrderServiceImpl implements ErpSaleOrderService {
if (item.getOutCount().equals(outCount)) {
return;
}
if (outCount.compareTo(item.getCount()) > 0) {
throw exception(SALE_ORDER_ITEM_OUT_FAIL_PRODUCT_EXCEED,
productService.getProduct(item.getProductId()).getName(), item.getCount());
}
// if (outCount.compareTo(item.getCount()) > 0) {
// throw exception(SALE_ORDER_ITEM_OUT_FAIL_PRODUCT_EXCEED,
// productService.getProduct(item.getProductId()).getName(), item.getCount());
// }
saleOrderItemMapper.updateById(new ErpSaleOrderItemDO().setId(item.getId()).setOutCount(outCount));
});
// 2. 更新销售订单

@ -104,6 +104,8 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
.setNo(no).setStatus(ErpAuditStatus.PROCESS.getStatus()))
.setOrderNo(saleOrder.getNo()).setCustomerId(saleOrder.getCustomerId());
calculateTotalPrice(saleOut, saleOutItems);
if(saleOut.getReceiptPrice()==null)
saleOut.setReceiptPrice(BigDecimal.ZERO);
saleOutMapper.insert(saleOut);
// 2.2 插入出库项
saleOutItems.forEach(o -> o.setOutId(saleOut.getId()));

@ -110,4 +110,17 @@ public class MqttServerDataController {
}
return success(BigDecimal.ZERO.doubleValue());
}
@PostMapping("/setSimulateValue")
@Operation(summary = "设置模拟数据默认值")
public CommonResult<String> setSimulateValue(@RequestParam("id")Long id,@RequestParam("resetValue") double resetValue) {
if(id!=null){
FormulaRecordDO recordDO = formulaRecordMapper.selectById(id);
if(recordDO==null)return success("操作失败");
recordDO.setDataValue(BigDecimal.valueOf(resetValue));
formulaRecordMapper.updateById(recordDO);
return success("操作失败");
}
return success("操作失败");
}
}

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.mes.framework.web;
import cn.hutool.core.util.RandomUtil;
import cn.iocoder.yudao.module.iot.dal.dataobject.formula.FormulaRecordDO;
import cn.iocoder.yudao.module.iot.dal.mysql.formula.FormulaRecordMapper;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
@Component
@EnableScheduling
public class ScheduledService {
@Resource
private FormulaRecordMapper formulaRecordMapper;
/**定时读取PLC*/
//@Scheduled(fixedDelay = 1000)
public void readPLCJob() {
System.out.println("-------定时读取PLC-------");
}
private void dealRecord(Long id, String type, boolean random, double plusValue, int min, int max){
if(id!=null){
FormulaRecordDO recordDO = formulaRecordMapper.selectById(id);
if(recordDO==null)return;
if(random){
if(type.equals("int")){
int i = RandomUtil.randomInt(min,max);
recordDO.setDataValue(recordDO.getDataValue().add(BigDecimal.valueOf(i)));
}
if(type.equals("double")){
double i = RandomUtil.randomDouble(min,max);
recordDO.setDataValue(recordDO.getDataValue().add(BigDecimal.valueOf(i)));
}
}
else{
recordDO.setDataValue(recordDO.getDataValue().add(BigDecimal.valueOf(plusValue)));
}
formulaRecordMapper.updateById(recordDO);
}
}
}
Loading…
Cancel
Save