|
@@ -10,7 +10,6 @@ import com.imcs.admin.common.config.SessionContext;
|
|
|
import com.imcs.admin.db.service.JdbcDao;
|
|
|
import com.imcs.admin.db.service.JdbcService;
|
|
|
import com.imcs.admin.util.GenerateSerial;
|
|
|
-import com.imcs.admin.util.StringUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -19,6 +18,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Service
|
|
@@ -395,14 +396,24 @@ public class BusinessServiceImpl implements BusinessService{
|
|
|
Integer planAmount = Integer.valueOf(one.get("planAmount").toString());
|
|
|
Integer scrapAmount = Integer.valueOf(one.get("scrapAmount").toString());
|
|
|
String scrapReason = map.get("scrapReason").toString();
|
|
|
+ String contractFile = map.get("contractFile").toString();
|
|
|
if(reportAmount + amount + scrapAmount > planAmount){
|
|
|
throw new RuntimeException("报工数量+报废数量超出生产数量,请核对报废数量!!!");
|
|
|
}
|
|
|
+ //更新文件类型
|
|
|
+ if(map.containsKey("contractFile") && !Objects.isNull(map.get("contractFile"))){
|
|
|
+ String businessType = "3";
|
|
|
+ Pattern pattern = Pattern.compile("/([^/]+)/[^/]+\\.(\\w+)");
|
|
|
+ Matcher matcher = pattern.matcher(contractFile);
|
|
|
+ if (matcher.find()) {
|
|
|
+ String extractedString = matcher.group(1);
|
|
|
+ jdbcService.update("更新","update sys_file set business_type = ? where id = ? ",businessType,extractedString);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
- String scrap="INSERT INTO a_work_scrap ( scrap_code, work_code, scrap_amount, scrap_person, scrap_reason, apply_status, create_time, production_work_order_id) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
- jdbcService.insert("执行sql",scrap,generateSerial.generateSerialNumber("aWorkScrap"),workCode,amount,getUserId(),scrapReason,0,new Date(),id);
|
|
|
- jdbcService.update("update a_production_work_order set scrap_amount=scrap_amount + ? where id = ?",amount,id);
|
|
|
+ String scrap="INSERT INTO a_work_scrap ( scrap_code, work_code, scrap_amount, scrap_person, scrap_reason, apply_status, create_time, production_work_order_id,scrap_file) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
+ jdbcService.insert("执行sql",scrap,generateSerial.generateSerialNumber("aWorkScrap"),workCode,amount,getUserId(),scrapReason,0,new Date(),id,contractFile);
|
|
|
+ jdbcService.update("update a_production_work_order set scrap_amount=scrap_amount + ?,scrap_file = ? where id = ?",amount,contractFile,id);
|
|
|
}
|
|
|
|
|
|
public Long getUserId(){
|