| | |
| | | import com.example.erp.entity.mm.MaterialStore; |
| | | import com.example.erp.entity.userInfo.SysError; |
| | | import com.example.erp.mapper.mm.BasicWarehouseTypeMapper; |
| | | import com.example.erp.mapper.mm.MaterialInventoryMapper; |
| | | import com.example.erp.mapper.mm.MaterialStoreMapper; |
| | | import com.example.erp.service.userInfo.SysErrorService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | |
| | | public class MaterialStoreService { |
| | | @Autowired |
| | | MaterialStoreMapper materialStoreMapper; |
| | | @Autowired |
| | | MaterialInventoryMapper materialInventoryMapper; |
| | | @Autowired |
| | | BasicWarehouseTypeMapper basicWarehouseTypeMapper; |
| | | @Autowired |
| | |
| | | String id = ""; |
| | | String type = ""; |
| | | String json = ""; |
| | | double width = 0.0; |
| | | double height = 0.0; |
| | | double singlePieceArea=0.0; |
| | | if (object.get("id") != null) { |
| | | id = object.get("id").toString(); |
| | | } |
| | |
| | | if (object.get("json") != null) { |
| | | json = object.get("json").toString(); |
| | | } |
| | | if (object.get("width") != null) { |
| | | width = Double.parseDouble(object.get("width").toString()); |
| | | } |
| | | if (object.get("height") != null) { |
| | | height = Double.parseDouble(object.get("height").toString()); |
| | | } |
| | | DecimalFormat decimalFormat = new DecimalFormat("#0.00"); |
| | | singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000)); |
| | | if(Long.parseLong(id)>0){ |
| | | materialStoreMapper.updateMaterialStore(type,json, Long.valueOf(id)); |
| | | if (Objects.equals(type, "原片")){ |
| | | materialInventoryMapper.updateMaterialInventoryArea(Long.valueOf(id),singlePieceArea); |
| | | } |
| | | }else{ |
| | | materialStoreMapper.insertMaterialStore(type,json); |
| | | } |