This commit is contained in:
xd 2024-03-13 09:55:47 +08:00
parent e9b8260d94
commit a71b565488
20 changed files with 993 additions and 904 deletions

View File

@ -1,15 +1,20 @@
package com.ruoyi.web.controller.material; package com.ruoyi.web.controller.material;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.clMaterial.domain.CYlMaterial; import com.ruoyi.clMaterial.domain.CYlMaterial;
import com.ruoyi.clMaterial.service.ICYlMaterialService; import com.ruoyi.clMaterial.service.ICYlMaterialService;
import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.material.domain.CMaterial; import com.ruoyi.material.domain.CMaterial;
import com.ruoyi.material.domain.cost;
import com.ruoyi.material.domain.material;
import com.ruoyi.material.domain.temp;
import com.ruoyi.materialType.domain.CMaterialType; import com.ruoyi.materialType.domain.CMaterialType;
import com.ruoyi.materialType.service.ICMaterialTypeService; import com.ruoyi.materialType.service.ICMaterialTypeService;
import com.ruoyi.web.utils.JDBCBatchInsert;
import org.apache.commons.collections4.ListUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -146,4 +151,588 @@ public class CMaterialController extends BaseController
{ {
return toAjax(cMaterialService.deleteCMaterialByMaterialIds(materialIds)); return toAjax(cMaterialService.deleteCMaterialByMaterialIds(materialIds));
} }
/**
* 同步物料材料用量
*/
@PreAuthorize("@ss.hasPermi('material:material:synchronizeMaterialData')")
@Log(title = "同步物料材料用量", businessType = BusinessType.UPDATE)
@PostMapping("/synchronizeUpdate")
public AjaxResult synchronizeUpdate() throws Exception
{
List<temp> templist = cMaterialService.selectTemp();
List<material> materials = new ArrayList<material>();
material m = new material();
List<cost> costs = new ArrayList<cost>();
cost c = new cost();
List<List<temp>> averageAssign = ListUtils.partition(templist, 5000);
int num = 1;
int num2 = 1;
for(List<temp> list:averageAssign){
for(temp t:list){
m = new material();
m.setMaterial_id(num);
m.setMaterial_xingh(t.getModel_1());
m.setMaterial_guig(t.getSpec_1());
m.setMaterial_diany(t.getVoltage_1());
m.setMaterial_dw(t.getUnit_0());
m.setMaterial_type_id(t.getType_no());
materials.add(m);
num++;
if("M001".equals(t.getM_id_M001())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M001());
c.setCost_cl_qty(t.getName_qty_M001());
costs.add(c);num2++;
}
if("M002".equals(t.getM_id_M002())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M002());
c.setCost_cl_qty(t.getName_qty_M002());
costs.add(c);num2++;
}
if("M003".equals(t.getM_id_M003())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M003());
c.setCost_cl_qty(t.getName_qty_M003());
c.setCost_cl_qty_2(t.getName_qty_M003_1());
costs.add(c);num2++;
}
if("M004".equals(t.getM_id_M004())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M004());
c.setCost_cl_qty(t.getName_qty_M004());
c.setCost_cl_qty_2(t.getName_qty_M004_1());
costs.add(c);num2++;
}
if("M005".equals(t.getM_id_M005())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M005());
c.setCost_cl_qty(t.getName_qty_M005());
c.setCost_cl_qty_2(t.getName_qty_M005_1());
costs.add(c);num2++;
}
if("M006".equals(t.getM_id_M006())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M006());
c.setCost_cl_qty(t.getName_qty_M006());
costs.add(c);num2++;
}
if("M007".equals(t.getM_id_M007())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M007());
c.setCost_cl_qty(t.getName_qty_M007());
costs.add(c);num2++;
}
if("M008".equals(t.getM_id_M008())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M008());
c.setCost_cl_qty(t.getName_qty_M008());
costs.add(c);num2++;
}
if("M009".equals(t.getM_id_M009())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M009());
c.setCost_cl_qty(t.getName_qty_M009());
costs.add(c);num2++;
}
if("M010".equals(t.getM_id_M010())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M010());
c.setCost_cl_qty(t.getName_qty_M010());
c.setCost_cl_qty_2(t.getName_qty_M010_1());
costs.add(c);num2++;
}
if("M011".equals(t.getM_id_M011())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M011());
c.setCost_cl_qty(t.getName_qty_M011());
costs.add(c);num2++;
}
if("M012".equals(t.getM_id_M012())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M012());
c.setCost_cl_qty(t.getName_qty_M012());
costs.add(c);num2++;
}
if("M013".equals(t.getM_id_M013())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M013());
c.setCost_cl_qty(t.getName_qty_M013());
costs.add(c);num2++;
}if("M014".equals(t.getM_id_M014())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M014());
c.setCost_cl_qty(t.getName_qty_M014());
costs.add(c);num2++;
}if("M015".equals(t.getM_id_M015())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M015());
c.setCost_cl_qty(t.getName_qty_M015());
costs.add(c);num2++;
}
if("M016".equals(t.getM_id_M016())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M016());
c.setCost_cl_qty(t.getName_qty_M016());
costs.add(c);num2++;
}
if("M017".equals(t.getM_id_M017())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M017());
c.setCost_cl_qty(t.getName_qty_M017());
costs.add(c);num2++;
}
if("M018".equals(t.getM_id_M018())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M018());
c.setCost_cl_qty(t.getName_qty_M018());
costs.add(c);num2++;
}if("M019".equals(t.getM_id_M019())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M019());
c.setCost_cl_qty(t.getName_qty_M019());
c.setCost_cl_qty_2(t.getName_qty_M019_1());
costs.add(c);num2++;
}
if("M020".equals(t.getM_id_M020())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M020());
c.setCost_cl_qty(t.getName_qty_M020());
costs.add(c);num2++;
}
if("M021".equals(t.getM_id_M021())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M021());
c.setCost_cl_qty(t.getName_qty_M021());
c.setCost_cl_qty_2(t.getName_qty_M021_1());
costs.add(c);num2++;
}
if("M022".equals(t.getM_id_M022())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M022());
c.setCost_cl_qty(t.getName_qty_M022());
costs.add(c);num2++;
}
if("M023".equals(t.getM_id_M023())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M023());
c.setCost_cl_qty(t.getName_qty_M023());
costs.add(c);num2++;
}if("M024".equals(t.getM_id_M024())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M024());
c.setCost_cl_qty(t.getName_qty_M024());
costs.add(c);num2++;
}if("M025".equals(t.getM_id_M025())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M025());
c.setCost_cl_qty(t.getName_qty_M025());
costs.add(c);num2++;
}
if("M026".equals(t.getM_id_M026())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M026());
c.setCost_cl_qty(t.getName_qty_M026());
costs.add(c);num2++;
}
if("M027".equals(t.getM_id_M027())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M027());
c.setCost_cl_qty(t.getName_qty_M027());
costs.add(c);num2++;
}
if("M028".equals(t.getM_id_M028())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M028());
c.setCost_cl_qty(t.getName_qty_M028());
costs.add(c);num2++;
}
if("M029".equals(t.getM_id_M029())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M029());
c.setCost_cl_qty(t.getName_qty_M029());
costs.add(c);num2++;
}if("M030".equals(t.getM_id_M030())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M030());
c.setCost_cl_qty(t.getName_qty_M030());
costs.add(c);num2++;
}if("M031".equals(t.getM_id_M031())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M031());
c.setCost_cl_qty(t.getName_qty_M031());
costs.add(c);num2++;
}if("M032".equals(t.getM_id_M032())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M032());
c.setCost_cl_qty(t.getName_qty_M032());
costs.add(c);num2++;
}if("M033".equals(t.getM_id_M033())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M033());
c.setCost_cl_qty(t.getName_qty_M033());
costs.add(c);num2++;
}if("M034".equals(t.getM_id_M034())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M034());
c.setCost_cl_qty(t.getName_qty_M034());
costs.add(c);num2++;
}
if("M035".equals(t.getM_id_M035())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M035());
c.setCost_cl_qty(t.getName_qty_M035());
costs.add(c);num2++;
}if("M036".equals(t.getM_id_M036())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M036());
c.setCost_cl_qty(t.getName_qty_M036());
costs.add(c);num2++;
}if("M037".equals(t.getM_id_M037())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M037());
c.setCost_cl_qty(t.getName_qty_M037());
c.setCost_cl_qty_2(t.getName_qty_M037_1());
costs.add(c);num2++;
}
if("M038".equals(t.getM_id_M038())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M038());
c.setCost_cl_qty(t.getName_qty_M038());
costs.add(c);num2++;
}
if("M039".equals(t.getM_id_M039())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M039());
c.setCost_cl_qty(t.getName_qty_M039());
c.setCost_cl_qty_2(t.getName_qty_M039_1());
costs.add(c);num2++;
}
if("M040".equals(t.getM_id_M040())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M040());
c.setCost_cl_qty(t.getName_qty_M040());
costs.add(c);num2++;
}
if("M041".equals(t.getM_id_M041())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M041());
c.setCost_cl_qty(t.getName_qty_M041());
costs.add(c);num2++;
}
if("M042".equals(t.getM_id_M042())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M042());
c.setCost_cl_qty(t.getName_qty_M042());
c.setCost_cl_qty_2(t.getName_qty_M042_1());
costs.add(c);num2++;
}
if("M043".equals(t.getM_id_M043())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M043());
c.setCost_cl_qty(t.getName_qty_M043());
costs.add(c);num2++;
}
if("M044".equals(t.getM_id_M044())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M044());
c.setCost_cl_qty(t.getName_qty_M044());
costs.add(c);num2++;
}
if("M045".equals(t.getM_id_M045())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M045());
c.setCost_cl_qty(t.getName_qty_M045());
costs.add(c);num2++;
}
if("M046".equals(t.getM_id_M046())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M046());
c.setCost_cl_qty(t.getName_qty_M046());
costs.add(c);num2++;
}if("M047".equals(t.getM_id_M047())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M047());
c.setCost_cl_qty(t.getName_qty_M047());
costs.add(c);num2++;
}if("M048".equals(t.getM_id_M048())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M048());
c.setCost_cl_qty(t.getName_qty_M048());
c.setCost_cl_qty_2(t.getName_qty_M048_1());
costs.add(c);num2++;
}if("M049".equals(t.getM_id_M049())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M049());
c.setCost_cl_qty(t.getName_qty_M049());
costs.add(c);num2++;
}
if("M050".equals(t.getM_id_M050())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M050());
c.setCost_cl_qty(t.getName_qty_M050());
costs.add(c);num2++;
}
if("M051".equals(t.getM_id_M051())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M051());
c.setCost_cl_qty(t.getName_qty_M051());
costs.add(c);num2++;
}
if("M052".equals(t.getM_id_M052())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M052());
c.setCost_cl_qty(t.getName_qty_M052());
costs.add(c);num2++;
}
if("M053".equals(t.getM_id_M053())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M053());
c.setCost_cl_qty(t.getName_qty_M053());
costs.add(c);num2++;
}
if("M054".equals(t.getM_id_M054())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M054());
c.setCost_cl_qty(t.getName_qty_M054());
costs.add(c);num2++;
}if("M055".equals(t.getM_id_M055())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M055());
c.setCost_cl_qty(t.getName_qty_M055());
costs.add(c);num2++;
}if("M056".equals(t.getM_id_M056())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M056());
c.setCost_cl_qty(t.getName_qty_M056());
costs.add(c);num2++;
}if("M057".equals(t.getM_id_M057())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M057());
c.setCost_cl_qty(t.getName_qty_M057());
costs.add(c);num2++;
}if("M058".equals(t.getM_id_M058())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M058());
c.setCost_cl_qty(t.getName_qty_M058());
costs.add(c);num2++;
}
if("M059".equals(t.getM_id_M059())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M059());
c.setCost_cl_qty(t.getName_qty_M059());
costs.add(c);num2++;
}
if("M060".equals(t.getM_id_M060())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M060());
c.setCost_cl_qty(t.getName_qty_M060());
costs.add(c);num2++;
}
if("M061".equals(t.getM_id_M061())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M061());
c.setCost_cl_qty(t.getName_qty_M061());
costs.add(c);num2++;
}
if("M062".equals(t.getM_id_M062())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M062());
c.setCost_cl_qty(t.getName_qty_M062());
costs.add(c);num2++;
}
if("M063".equals(t.getM_id_M063())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M063());
c.setCost_cl_qty(t.getName_qty_M063());
costs.add(c);num2++;
}
if("M064".equals(t.getM_id_M064())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M064());
c.setCost_cl_qty(t.getName_qty_M064());
costs.add(c);num2++;
}
if("M065".equals(t.getM_id_M065())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M065());
c.setCost_cl_qty(t.getName_qty_M065());
costs.add(c);num2++;
}
if("M066".equals(t.getM_id_M066())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M066());
c.setCost_cl_qty(t.getName_qty_M066());
costs.add(c);num2++;
}
if("M067".equals(t.getM_id_M067())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M067());
c.setCost_cl_qty(t.getName_qty_M067());
costs.add(c);num2++;
}
if("M068".equals(t.getM_id_M068())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M068());
c.setCost_cl_qty(t.getName_qty_M068());
costs.add(c);num2++;
}
}
}
System.out.println("materials===================="+materials.size());
System.out.println("costs======================="+costs.size());
try {
JDBCBatchInsert.insertMaterialBatch(materials);
JDBCBatchInsert.insertCostBatch(costs);
}catch (Exception e) {
throw new Exception(e.getMessage(), e);
}
return success();
}
} }

View File

@ -5,12 +5,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.system.domain.cost;
import com.ruoyi.system.domain.material;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -66,9 +62,6 @@ public class SysUserController extends BaseController
@Autowired @Autowired
private ISysPostService postService; private ISysPostService postService;
@Autowired
private TestService testService;
/** /**
* 获取用户列表 * 获取用户列表
*/ */
@ -307,588 +300,4 @@ public class SysUserController extends BaseController
return success(deptService.selectDeptTreeList(dept)); return success(deptService.selectDeptTreeList(dept));
} }
/*===============================================测试====================================================*/
/**@DataSource(DataSourceType.QUOT)
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:user:export')")
@PostMapping("/export")
public void export(HttpServletResponse response) throws Exception {
List<temp> templist = testService.selectTemp();
List<material> materials = new ArrayList<material>();
material m = new material();
List<cost> costs = new ArrayList<cost>();
cost c = new cost();
List<List<temp>> averageAssign = ListUtils.partition(templist, 5000);
int num = 1;
int num2 = 1;
for(List<temp> list:averageAssign){
for(temp t:list){
m = new material();
m.setMaterial_id(num);
m.setMaterial_xingh(t.getModel_1());
m.setMaterial_guig(t.getSpec_1());
m.setMaterial_diany(t.getVoltage_1());
m.setMaterial_dw(t.getUnit_0());
m.setMaterial_type_id(t.getType_no());
materials.add(m);
num++;
if("M001".equals(t.getM_id_M001())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M001());
c.setCost_cl_qty(t.getName_qty_M001());
costs.add(c);num2++;
}
if("M002".equals(t.getM_id_M002())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M002());
c.setCost_cl_qty(t.getName_qty_M002());
costs.add(c);num2++;
}
if("M003".equals(t.getM_id_M003())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M003());
c.setCost_cl_qty_2(t.getName_qty_M003_1());
costs.add(c);num2++;
}
if("M004".equals(t.getM_id_M004())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M004());
c.setCost_cl_qty(t.getName_qty_M004());
c.setCost_cl_qty_2(t.getName_qty_M004_1());
costs.add(c);num2++;
}
if("M005".equals(t.getM_id_M005())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M005());
c.setCost_cl_qty(t.getName_qty_M005());
c.setCost_cl_qty_2(t.getName_qty_M005_1());
costs.add(c);num2++;
}
if("M006".equals(t.getM_id_M006())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M006());
c.setCost_cl_qty(t.getName_qty_M006());
costs.add(c);num2++;
}
if("M007".equals(t.getM_id_M007())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M007());
c.setCost_cl_qty(t.getName_qty_M007());
costs.add(c);num2++;
}
if("M008".equals(t.getM_id_M008())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M008());
c.setCost_cl_qty(t.getName_qty_M008());
costs.add(c);num2++;
}
if("M009".equals(t.getM_id_M009())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M009());
c.setCost_cl_qty(t.getName_qty_M009());
costs.add(c);num2++;
}
if("M010".equals(t.getM_id_M010())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M010());
c.setCost_cl_qty(t.getName_qty_M010());
c.setCost_cl_qty_2(t.getName_qty_M010_1());
costs.add(c);num2++;
}
if("M011".equals(t.getM_id_M011())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M011());
c.setCost_cl_qty(t.getName_qty_M011());
costs.add(c);num2++;
}
if("M012".equals(t.getM_id_M012())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M012());
c.setCost_cl_qty(t.getName_qty_M012());
costs.add(c);num2++;
}
if("M013".equals(t.getM_id_M013())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M013());
c.setCost_cl_qty(t.getName_qty_M013());
costs.add(c);num2++;
}if("M014".equals(t.getM_id_M014())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M014());
c.setCost_cl_qty(t.getName_qty_M014());
costs.add(c);num2++;
}if("M015".equals(t.getM_id_M015())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M015());
c.setCost_cl_qty(t.getName_qty_M015());
costs.add(c);num2++;
}
if("M016".equals(t.getM_id_M016())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M016());
c.setCost_cl_qty(t.getName_qty_M016());
costs.add(c);num2++;
}
if("M017".equals(t.getM_id_M017())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M017());
c.setCost_cl_qty(t.getName_qty_M017());
costs.add(c);num2++;
}
if("M018".equals(t.getM_id_M018())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M018());
c.setCost_cl_qty(t.getName_qty_M018());
costs.add(c);num2++;
}if("M019".equals(t.getM_id_M019())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M019());
c.setCost_cl_qty(t.getName_qty_M019());
c.setCost_cl_qty_2(t.getName_qty_M019_1());
costs.add(c);num2++;
}
if("M020".equals(t.getM_id_M020())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M020());
c.setCost_cl_qty(t.getName_qty_M020());
costs.add(c);num2++;
}
if("M021".equals(t.getM_id_M021())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M021());
c.setCost_cl_qty(t.getName_qty_M021());
c.setCost_cl_qty_2(t.getName_qty_M021_1());
costs.add(c);num2++;
}
if("M022".equals(t.getM_id_M022())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M022());
c.setCost_cl_qty(t.getName_qty_M022());
costs.add(c);num2++;
}
if("M023".equals(t.getM_id_M023())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M023());
c.setCost_cl_qty(t.getName_qty_M023());
costs.add(c);num2++;
}if("M024".equals(t.getM_id_M024())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M024());
c.setCost_cl_qty(t.getName_qty_M024());
costs.add(c);num2++;
}if("M025".equals(t.getM_id_M025())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M025());
c.setCost_cl_qty(t.getName_qty_M025());
costs.add(c);num2++;
}
if("M026".equals(t.getM_id_M026())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M026());
c.setCost_cl_qty(t.getName_qty_M026());
costs.add(c);num2++;
}
if("M027".equals(t.getM_id_M027())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M027());
c.setCost_cl_qty(t.getName_qty_M027());
costs.add(c);num2++;
}
if("M028".equals(t.getM_id_M028())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M028());
c.setCost_cl_qty(t.getName_qty_M028());
costs.add(c);num2++;
}
if("M029".equals(t.getM_id_M029())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M029());
c.setCost_cl_qty(t.getName_qty_M029());
costs.add(c);num2++;
}if("M030".equals(t.getM_id_M030())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M030());
c.setCost_cl_qty(t.getName_qty_M030());
costs.add(c);num2++;
}if("M031".equals(t.getM_id_M031())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M031());
c.setCost_cl_qty(t.getName_qty_M031());
costs.add(c);num2++;
}if("M032".equals(t.getM_id_M032())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M032());
c.setCost_cl_qty(t.getName_qty_M032());
costs.add(c);num2++;
}if("M033".equals(t.getM_id_M033())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M033());
c.setCost_cl_qty(t.getName_qty_M033());
costs.add(c);num2++;
}if("M034".equals(t.getM_id_M034())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M034());
c.setCost_cl_qty(t.getName_qty_M034());
costs.add(c);num2++;
}
if("M035".equals(t.getM_id_M035())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M035());
c.setCost_cl_qty(t.getName_qty_M035());
costs.add(c);num2++;
}if("M036".equals(t.getM_id_M036())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M036());
c.setCost_cl_qty(t.getName_qty_M036());
costs.add(c);num2++;
}if("M037".equals(t.getM_id_M037())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M037());
c.setCost_cl_qty(t.getName_qty_M037());
c.setCost_cl_qty_2(t.getName_qty_M037_1());
costs.add(c);num2++;
}
if("M038".equals(t.getM_id_M038())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M038());
c.setCost_cl_qty(t.getName_qty_M038());
costs.add(c);num2++;
}
if("M039".equals(t.getM_id_M039())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M039());
c.setCost_cl_qty(t.getName_qty_M039());
c.setCost_cl_qty_2(t.getName_qty_M039_1());
costs.add(c);num2++;
}
if("M040".equals(t.getM_id_M040())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M040());
c.setCost_cl_qty(t.getName_qty_M040());
costs.add(c);num2++;
}
if("M041".equals(t.getM_id_M041())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M041());
c.setCost_cl_qty(t.getName_qty_M041());
costs.add(c);num2++;
}
if("M042".equals(t.getM_id_M042())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M042());
c.setCost_cl_qty(t.getName_qty_M042());
c.setCost_cl_qty_2(t.getName_qty_M042_1());
costs.add(c);num2++;
}
if("M043".equals(t.getM_id_M043())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M043());
c.setCost_cl_qty(t.getName_qty_M043());
costs.add(c);num2++;
}
if("M044".equals(t.getM_id_M044())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M044());
c.setCost_cl_qty(t.getName_qty_M044());
costs.add(c);num2++;
}
if("M045".equals(t.getM_id_M045())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M045());
c.setCost_cl_qty(t.getName_qty_M045());
costs.add(c);num2++;
}
if("M046".equals(t.getM_id_M046())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M046());
c.setCost_cl_qty(t.getName_qty_M046());
costs.add(c);num2++;
}if("M047".equals(t.getM_id_M047())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M047());
c.setCost_cl_qty(t.getName_qty_M047());
costs.add(c);num2++;
}if("M048".equals(t.getM_id_M048())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M048());
c.setCost_cl_qty(t.getName_qty_M048());
c.setCost_cl_qty_2(t.getName_qty_M048_1());
costs.add(c);num2++;
}if("M049".equals(t.getM_id_M049())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M049());
c.setCost_cl_qty(t.getName_qty_M049());
costs.add(c);num2++;
}
if("M050".equals(t.getM_id_M050())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M050());
c.setCost_cl_qty(t.getName_qty_M050());
costs.add(c);num2++;
}
if("M051".equals(t.getM_id_M051())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M051());
c.setCost_cl_qty(t.getName_qty_M051());
costs.add(c);num2++;
}
if("M052".equals(t.getM_id_M052())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M052());
c.setCost_cl_qty(t.getName_qty_M052());
costs.add(c);num2++;
}
if("M053".equals(t.getM_id_M053())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M053());
c.setCost_cl_qty(t.getName_qty_M053());
costs.add(c);num2++;
}
if("M054".equals(t.getM_id_M054())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M054());
c.setCost_cl_qty(t.getName_qty_M054());
costs.add(c);num2++;
}if("M055".equals(t.getM_id_M055())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M055());
c.setCost_cl_qty(t.getName_qty_M055());
costs.add(c);num2++;
}if("M056".equals(t.getM_id_M056())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M056());
c.setCost_cl_qty(t.getName_qty_M056());
costs.add(c);num2++;
}if("M057".equals(t.getM_id_M057())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M057());
c.setCost_cl_qty(t.getName_qty_M057());
costs.add(c);num2++;
}if("M058".equals(t.getM_id_M058())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M058());
c.setCost_cl_qty(t.getName_qty_M058());
costs.add(c);num2++;
}
if("M059".equals(t.getM_id_M059())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M059());
c.setCost_cl_qty(t.getName_qty_M059());
costs.add(c);num2++;
}
if("M060".equals(t.getM_id_M060())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M060());
c.setCost_cl_qty(t.getName_qty_M060());
costs.add(c);num2++;
}
if("M061".equals(t.getM_id_M061())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M061());
c.setCost_cl_qty(t.getName_qty_M061());
costs.add(c);num2++;
}
if("M062".equals(t.getM_id_M062())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M062());
c.setCost_cl_qty(t.getName_qty_M062());
costs.add(c);num2++;
}
if("M063".equals(t.getM_id_M063())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M063());
c.setCost_cl_qty(t.getName_qty_M063());
costs.add(c);num2++;
}
if("M064".equals(t.getM_id_M064())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M064());
c.setCost_cl_qty(t.getName_qty_M064());
costs.add(c);num2++;
}
if("M065".equals(t.getM_id_M065())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M065());
c.setCost_cl_qty(t.getName_qty_M065());
costs.add(c);num2++;
}
if("M066".equals(t.getM_id_M066())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M066());
c.setCost_cl_qty(t.getName_qty_M066());
costs.add(c);num2++;
}
if("M067".equals(t.getM_id_M067())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M067());
c.setCost_cl_qty(t.getName_qty_M067());
costs.add(c);num2++;
}
if("M068".equals(t.getM_id_M068())){
c = new cost();
c.setCost_id(num2);
c.setCost_material_id(m.getMaterial_id());
c.setCost_cl_id(t.getM_id_M068());
c.setCost_cl_qty(t.getName_qty_M068());
costs.add(c);num2++;
}
}
}
System.out.println("materials===================="+materials.size());
System.out.println("costs======================="+costs.size());
batchInsert.insertMaterialBatch(materials);
batchInsert.insertCostBatch(costs);
}**/
@DataSource(DataSourceType.QUOT)
public void insertMaterialBatch(List<material> temp) {
testService.insertMaterialBatch(temp);
}
@DataSource(DataSourceType.QUOT)
public void insertCostBatch(List<cost> temp) {
testService.insertCostBatch(temp);
}
} }

View File

@ -1,63 +0,0 @@
/*
package com.ruoyi.web.Utils;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import javax.sql.DataSource;
import java.beans.PropertyVetoException;
import java.sql.Connection;
*/
/**
* 数据库操作
*
* @author Administrator
*
*//*
public class DataDBUtils {
private static DataSource ds;
static {
ComboPooledDataSource cpds = null;
try {
cpds = new ComboPooledDataSource();
cpds.setCheckoutTimeout(30000);
cpds.setIdleConnectionTestPeriod(30);
cpds.setInitialPoolSize(10);
cpds.setMaxIdleTime(30);//
cpds.setMaxPoolSize(30);
cpds.setMaxStatementsPerConnection(100);
cpds.setMinPoolSize(5);
cpds.setMaxStatements(75);
cpds.setAcquireIncrement(3);
cpds.setNumHelperThreads(3);
cpds.setDriverClass("com.microsoft.sqlserver.jdbc.SQLServerDriver");
cpds.setJdbcUrl("jdbc:sqlserver://192.168.9.99:1433;DatabaseName=jn_quot");
cpds.setUser("sa");
cpds.setPassword("Itcenter110-");
ds = cpds;
} catch (PropertyVetoException e) {
System.out.println("与SqlServer数据库连接失败");
}
}
private DataDBUtils() {
}
public static DataSource getDatasSource() {
return ds;
}
public static Connection getConnection() {
Connection con = null;
try {
con = ds.getConnection();// 每一次从ds中获取一个新的连接
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
}
*/

View File

@ -0,0 +1,161 @@
package com.ruoyi.web.utils;
import com.ruoyi.material.domain.cost;
import com.ruoyi.material.domain.material;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import java.util.Random;
@Component
public class JDBCBatchInsert {
private static String databaseURL;
public static String getDatabaseURL() {
return databaseURL;
}
@Value(value = "${spring.datasource.druid.quot.url}")
public void setDatabaseUR(String databaseURL) {
JDBCBatchInsert.databaseURL = databaseURL;
}
private static String username;
public static String getUsername() {return username;}
@Value(value = "${spring.datasource.druid.quot.username}")
public void setUsername(String username) {
JDBCBatchInsert.username = username;
}
private static String password;
public static String getPassword() {
return password;
}
@Value(value = "${spring.datasource.druid.quot.password}")
public void setPassword(String password) {
JDBCBatchInsert.password = password;
}
public static void insertMaterialBatch(List<material> list) throws IOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = DriverManager.getConnection(databaseURL, username, password);
// 关闭自动提交事务改为手动提交
connection.setAutoCommit(false);
System.out.println("===== 开始插入数据 =====");
long startTime = System.currentTimeMillis();
String sqlInsert = "insert into c_material(material_id, material_xingh, material_guig, material_diany, material_dw,material_type_id) values (?,?,?,?,?,?)";
preparedStatement = connection.prepareStatement(sqlInsert);
Random random = new Random();
for (int i = 0; i < list.size(); i++) {
preparedStatement.setInt(1, list.get(i).getMaterial_id());
preparedStatement.setString(2, list.get(i).getMaterial_xingh());
preparedStatement.setString(3, list.get(i).getMaterial_guig());
preparedStatement.setString(4, list.get(i).getMaterial_diany());
preparedStatement.setString(5, list.get(i).getMaterial_dw());
preparedStatement.setString(6, list.get(i).getMaterial_type_id());
// 添加到批处理中
preparedStatement.addBatch();
if (i % 10000 == 0) {
// 每1000条数据提交一次
preparedStatement.executeBatch();
connection.commit();
System.out.println("成功插入第 "+ i+" 条数据");
}
}
// 处理剩余的数据
preparedStatement.executeBatch();
connection.commit();
long spendTime = System.currentTimeMillis()-startTime;
System.out.println("成功插入"+ list.size()+" 条数据,耗时:"+spendTime+"毫秒");
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
} finally {
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
public static void insertCostBatch(List<cost> list) throws IOException {
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = DriverManager.getConnection(databaseURL, username, password);
// 关闭自动提交事务改为手动提交
connection.setAutoCommit(false);
System.out.println("===== 开始插入数据 =====");
long startTime = System.currentTimeMillis();
String sqlInsert = "insert into c_material_cost(cost_id, cost_material_id, cost_cl_id, cost_cl_qty, cost_cl_qty_2) values (?,?,?,?,?)";
preparedStatement = connection.prepareStatement(sqlInsert);
Random random = new Random();
for (int i = 0; i < list.size(); i++) {
preparedStatement.setInt(1, list.get(i).getCost_id());
preparedStatement.setInt(2, list.get(i).getCost_material_id());
preparedStatement.setString(3, list.get(i).getCost_cl_id());
preparedStatement.setString(4, list.get(i).getCost_cl_qty());
preparedStatement.setString(5, list.get(i).getCost_cl_qty_2());
// 添加到批处理中
preparedStatement.addBatch();
if (i % 10000 == 0) {
// 每1000条数据提交一次
preparedStatement.executeBatch();
connection.commit();
System.out.println("成功插入第 "+ i+" 条数据");
}
}
// 处理剩余的数据
preparedStatement.executeBatch();
connection.commit();
long spendTime = System.currentTimeMillis()-startTime;
System.out.println("成功插入"+ list.size()+" 条数据,耗时:"+spendTime+"毫秒");
} catch (SQLException e) {
System.out.println("Error: " + e.getMessage());
} finally {
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}

View File

@ -1,118 +0,0 @@
/*
package com.ruoyi.web.Utils;
import com.ruoyi.system.domain.cost;
import com.ruoyi.system.domain.material;
import javax.swing.*;
import java.sql.*;
import java.util.List;
public class batchInsert extends JFrame {
public static Connection conn;
public static Statement stm;
public static PreparedStatement stmt;
public static ResultSet rs;
*/
/**
* 对数据库进行批量插入数据操作 执行次数100万
*//*
public static void insertMaterialBatch(List<material> list) throws Exception {
// 思路将100万条数据分成n等份1等份为1000条数据
// 如何实现
// 1必须将Connection接口的自动提交方式改为手动
// 2利用Statement接口中的如下三个方法addBatchclearBathexecuteBatch
conn = DataDBUtils.getConnection();
conn.setAutoCommit(false);
*/
/*stmt = conn.prepareStatement(
"insert into [dbo].[sapcontract_test](uid,bh,type,custom,salesman,project,htje,startdate,enddate,remark,htzt) values (?,?,?,?,?,?,?,?,?,?,?)");*//*
stmt = conn.prepareStatement(
"insert into c_material(material_id, material_xingh, material_guig, material_diany, material_dw,material_type_id) values (?,?,?,?,?,?)");
int count = 0;
System.err.println("Start");
for (material pay : list) {
count++;
stmt.setInt(1, pay.getMaterial_id());
stmt.setString(2, pay.getMaterial_xingh());
stmt.setString(3, pay.getMaterial_guig());
stmt.setString(4, pay.getMaterial_diany());
stmt.setString(5, pay.getMaterial_dw());
stmt.setString(6, pay.getMaterial_type_id());
stmt.addBatch();
if (count % 5000 == 0) {// 当增加了500个批处理的时候再提交
stmt.executeBatch();// 执行批处理
conn.commit();
}
}
stmt.executeBatch();// 执行批处理
conn.commit();
close(); // 关闭资源
}
*/
/**
* 对数据库进行批量插入数据操作 执行次数100万
*//*
public static void insertCostBatch(List<cost> list) throws Exception {
// 思路将100万条数据分成n等份1等份为1000条数据
// 如何实现
// 1必须将Connection接口的自动提交方式改为手动
// 2利用Statement接口中的如下三个方法addBatchclearBathexecuteBatch
conn = DataDBUtils.getConnection();
conn.setAutoCommit(false);
*/
/*stmt = conn.prepareStatement(
"insert into [dbo].[sapcontract_test](uid,bh,type,custom,salesman,project,htje,startdate,enddate,remark,htzt) values (?,?,?,?,?,?,?,?,?,?,?)");*//*
stmt = conn.prepareStatement(
"insert into c_material_cost(cost_id, cost_material_id, cost_cl_id, cost_cl_qty, cost_cl_qty_2) values (?,?,?,?,?)");
int count = 0;
System.err.println("Start");
for (cost pay : list) {
count++;
stmt.setInt(1, pay.getCost_id());
stmt.setInt(2, pay.getCost_material_id());
stmt.setString(3, pay.getCost_cl_id());
stmt.setString(4, pay.getCost_cl_qty());
stmt.setString(5, pay.getCost_cl_qty_2());
stmt.addBatch();
if (count % 5000 == 0) {// 当增加了500个批处理的时候再提交
stmt.executeBatch();// 执行批处理
conn.commit();
}
}
stmt.executeBatch();// 执行批处理
conn.commit();
close(); // 关闭资源
}
public static void close() {
try {
if (rs != null)
rs.close();
if (stmt != null)
stmt.close();
if (stm != null)
stm.close();
if (conn != null)
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
*/

View File

@ -5,7 +5,7 @@ ruoyi:
# 版本 # 版本
version: 3.8.7 version: 3.8.7
# 版权年份 # 版权年份
copyrightYear: 2023 copyrightYear: 2024
# 实例演示开关 # 实例演示开关
demoEnabled: true demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath # 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath

View File

@ -157,7 +157,7 @@ public class Constants
/** /**
* 定时任务白名单配置仅允许访问的包名如其他需要可以自行添加 * 定时任务白名单配置仅允许访问的包名如其他需要可以自行添加
*/ */
public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" }; public static final String[] JOB_WHITELIST_STR = { "com.ruoyi.quartz.task" };
/** /**
* 定时任务违规的字符 * 定时任务违规的字符

View File

@ -14,12 +14,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="exceptionInfo" column="exception_info" /> <result property="exceptionInfo" column="exception_info" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
</resultMap> </resultMap>
<sql id="selectJobLogVo"> <sql id="selectJobLogVo">
select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time select job_log_id, job_name, job_group, invoke_target, job_message, status, exception_info, create_time
from sys_job_log from sys_job_log
</sql> </sql>
<select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult"> <select id="selectJobLogList" parameterType="SysJobLog" resultMap="SysJobLogResult">
<include refid="selectJobLogVo"/> <include refid="selectJobLogVo"/>
<where> <where>
@ -44,32 +44,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and datediff(d, create_time, #{params.endTime}) <![CDATA[>=]]> 0 and datediff(d, create_time, #{params.endTime}) <![CDATA[>=]]> 0
</if> </if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectJobLogAll" resultMap="SysJobLogResult"> <select id="selectJobLogAll" resultMap="SysJobLogResult">
<include refid="selectJobLogVo"/> <include refid="selectJobLogVo"/>
</select> </select>
<select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult"> <select id="selectJobLogById" parameterType="Long" resultMap="SysJobLogResult">
<include refid="selectJobLogVo"/> <include refid="selectJobLogVo"/>
where job_log_id = #{jobLogId} where job_log_id = #{jobLogId}
</select> </select>
<delete id="deleteJobLogById" parameterType="Long"> <delete id="deleteJobLogById" parameterType="Long">
delete from sys_job_log where job_log_id = #{jobLogId} delete from sys_job_log where job_log_id = #{jobLogId}
</delete> </delete>
<delete id="deleteJobLogByIds" parameterType="Long"> <delete id="deleteJobLogByIds" parameterType="Long">
delete from sys_job_log where job_log_id in delete from sys_job_log where job_log_id in
<foreach collection="array" item="jobLogId" open="(" separator="," close=")"> <foreach collection="array" item="jobLogId" open="(" separator="," close=")">
#{jobLogId} #{jobLogId}
</foreach> </foreach>
</delete> </delete>
<update id="cleanJobLog"> <update id="cleanJobLog">
truncate table sys_job_log truncate table sys_job_log
</update> </update>
<insert id="insertJobLog" parameterType="SysJobLog"> <insert id="insertJobLog" parameterType="SysJobLog">
insert into sys_job_log( insert into sys_job_log(
<if test="jobLogId != null and jobLogId != 0">job_log_id,</if> <if test="jobLogId != null and jobLogId != 0">job_log_id,</if>
@ -92,4 +93,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</insert> </insert>
</mapper> </mapper>

View File

@ -1,4 +1,4 @@
package com.ruoyi.system.domain; package com.ruoyi.material.domain;
public class cost { public class cost {
private Integer cost_id; private Integer cost_id;

View File

@ -1,4 +1,4 @@
package com.ruoyi.system.domain; package com.ruoyi.material.domain;
public class material { public class material {
private Integer material_id; private Integer material_id;

View File

@ -1,4 +1,4 @@
package com.ruoyi.system.domain; package com.ruoyi.material.domain;
public class temp { public class temp {
private String type_no; private String type_no;

View File

@ -3,18 +3,19 @@ package com.ruoyi.material.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.material.domain.CMaterial; import com.ruoyi.material.domain.CMaterial;
import com.ruoyi.material.domain.CMaterialCost; import com.ruoyi.material.domain.CMaterialCost;
import com.ruoyi.material.domain.temp;
/** /**
* 物料管理Mapper接口 * 物料管理Mapper接口
* *
* @author ruoyi * @author ruoyi
* @date 2024-02-28 * @date 2024-02-28
*/ */
public interface CMaterialMapper public interface CMaterialMapper
{ {
/** /**
* 查询物料管理 * 查询物料管理
* *
* @param materialId 物料管理主键 * @param materialId 物料管理主键
* @return 物料管理 * @return 物料管理
*/ */
@ -22,7 +23,7 @@ public interface CMaterialMapper
/** /**
* 查询物料管理列表 * 查询物料管理列表
* *
* @param cMaterial 物料管理 * @param cMaterial 物料管理
* @return 物料管理集合 * @return 物料管理集合
*/ */
@ -30,7 +31,7 @@ public interface CMaterialMapper
/** /**
* 新增物料管理 * 新增物料管理
* *
* @param cMaterial 物料管理 * @param cMaterial 物料管理
* @return 结果 * @return 结果
*/ */
@ -38,7 +39,7 @@ public interface CMaterialMapper
/** /**
* 修改物料管理 * 修改物料管理
* *
* @param cMaterial 物料管理 * @param cMaterial 物料管理
* @return 结果 * @return 结果
*/ */
@ -46,7 +47,7 @@ public interface CMaterialMapper
/** /**
* 删除物料管理 * 删除物料管理
* *
* @param materialId 物料管理主键 * @param materialId 物料管理主键
* @return 结果 * @return 结果
*/ */
@ -54,7 +55,7 @@ public interface CMaterialMapper
/** /**
* 批量删除物料管理 * 批量删除物料管理
* *
* @param materialIds 需要删除的数据主键集合 * @param materialIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
@ -62,26 +63,32 @@ public interface CMaterialMapper
/** /**
* 批量删除物料成本 * 批量删除物料成本
* *
* @param materialIds 需要删除的数据主键集合 * @param materialIds 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deleteCMaterialCostByCostMaterialIds(Long[] materialIds); public int deleteCMaterialCostByCostMaterialIds(Long[] materialIds);
/** /**
* 批量新增物料成本 * 批量新增物料成本
* *
* @param cMaterialCostList 物料成本列表 * @param cMaterialCostList 物料成本列表
* @return 结果 * @return 结果
*/ */
public int batchCMaterialCost(List<CMaterialCost> cMaterialCostList); public int batchCMaterialCost(List<CMaterialCost> cMaterialCostList);
/** /**
* 通过物料管理主键删除物料成本信息 * 通过物料管理主键删除物料成本信息
* *
* @param materialId 物料管理ID * @param materialId 物料管理ID
* @return 结果 * @return 结果
*/ */
public int deleteCMaterialCostByCostMaterialId(Long materialId); public int deleteCMaterialCostByCostMaterialId(Long materialId);
/**
* 拉取临时物料及用量表
* @return
*/
List<temp> selectTemp();
} }

View File

@ -1,6 +1,7 @@
package com.ruoyi.material.service; package com.ruoyi.material.service;
import com.ruoyi.material.domain.CMaterial; import com.ruoyi.material.domain.CMaterial;
import com.ruoyi.material.domain.temp;
import java.util.List; import java.util.List;
@ -59,4 +60,10 @@ public interface ICMaterialService
* @return 结果 * @return 结果
*/ */
public int deleteCMaterialByMaterialId(Long materialId); public int deleteCMaterialByMaterialId(Long materialId);
/**
* 拉取临时物料及用量表
* @return
*/
List<temp> selectTemp();
} }

View File

@ -3,6 +3,7 @@ package com.ruoyi.material.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.material.domain.CMaterial; import com.ruoyi.material.domain.CMaterial;
import com.ruoyi.material.domain.temp;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
@ -129,4 +130,13 @@ public class CMaterialServiceImpl implements ICMaterialService
} }
} }
} }
/**
* 拉取临时物料及用量表
* @return
*/
@Override
public List<temp> selectTemp() {
return cMaterialMapper.selectTemp();
}
} }

View File

@ -1,22 +0,0 @@
package com.ruoyi.system.mapper;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.domain.cost;
import com.ruoyi.system.domain.material;
import com.ruoyi.system.domain.temp;
import java.util.List;
/**
* 参数配置 数据层
*
* @author ruoyi
*/
public interface testMapper
{
public List<temp> selectTemp();
void insertMaterialBatch(List<material> temp);
void insertCostBatch(List<cost> temp);
}

View File

@ -1,21 +0,0 @@
package com.ruoyi.system.service;
import com.ruoyi.system.domain.cost;
import com.ruoyi.system.domain.material;
import com.ruoyi.system.domain.temp;
import java.util.List;
/**
* 用户 业务层
*
* @author ruoyi
*/
public interface TestService
{
public List<temp> selectTemp();
void insertMaterialBatch(List<material> temp);
void insertCostBatch(List<cost> temp);
}

View File

@ -1,58 +0,0 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.mapper.*;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.TestService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户 业务层处理
*
* @author ruoyi
*/
@Service
public class TestServiceImpl implements TestService
{
private static final Logger log = LoggerFactory.getLogger(TestServiceImpl.class);
@Resource
private testMapper testmapper;
@Override
public List<temp> selectTemp() {
return testmapper.selectTemp();
}
@Override
public void insertMaterialBatch(List<material> temp) {
testmapper.insertMaterialBatch(temp);
}
@Override
public void insertCostBatch(List<cost> temp) {
testmapper.insertCostBatch(temp);
}
}

View File

@ -126,4 +126,163 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.costMaterialId}, #{item.costClId}, cast(#{item.costClQty} as decimal(18,4)), cast(#{item.costClQty2} as decimal(18,4))) ( #{item.costMaterialId}, #{item.costClId}, cast(#{item.costClQty} as decimal(18,4)), cast(#{item.costClQty2} as decimal(18,4)))
</foreach> </foreach>
</insert> </insert>
<select id="selectTemp" resultType="com.ruoyi.system.domain.temp">
select b.type_no,[uid_0]
,[model_0]
,[model_1]
,[spec_0]
,[spec_1]
,[voltage_0]
,[voltage_1]
,[unit_0]
,RTRIM([m_id_M001]) m_id_M001
,RTRIM([name_qty_M001]) name_qty_M001
,RTRIM([m_id_M002]) m_id_M002
,RTRIM([name_qty_M002]) name_qty_M002
,RTRIM([m_id_M003]) m_id_M003
,RTRIM([name_qty_M003]) name_qty_M003
,RTRIM([name_qty_M003_1]) name_qty_M003_1
,RTRIM([m_id_M004]) m_id_M004
,RTRIM([name_qty_M004]) name_qty_M004
,RTRIM([name_qty_M004_1]) name_qty_M004_1
,RTRIM([m_id_M005]) m_id_M005
,RTRIM([name_qty_M005]) name_qty_M005
,RTRIM([name_qty_M005_1]) name_qty_M005_1
,RTRIM([m_id_M006]) m_id_M006
,RTRIM([name_qty_M006]) name_qty_M006
,RTRIM([m_id_M007]) m_id_M007
,RTRIM([name_qty_M007]) name_qty_M007
,RTRIM([m_id_M008]) m_id_M008
,RTRIM([name_qty_M008]) name_qty_M008
,RTRIM([m_id_M009]) m_id_M009
,RTRIM([name_qty_M009]) name_qty_M009
,RTRIM([m_id_M010]) m_id_M010
,RTRIM([name_qty_M010]) name_qty_M010
,RTRIM([name_qty_M010_1]) name_qty_M010_1
,RTRIM([m_id_M011]) m_id_M011
,RTRIM([name_qty_M011]) name_qty_M011
,RTRIM([m_id_M012]) m_id_M012
,RTRIM([name_qty_M012]) name_qty_M012
,RTRIM([m_id_M013]) m_id_M013
,RTRIM([name_qty_M013]) name_qty_M013
,RTRIM([m_id_M014]) m_id_M014
,RTRIM([name_qty_M014]) name_qty_M014
,RTRIM([m_id_M015]) m_id_M015
,RTRIM([name_qty_M015]) name_qty_M015
,RTRIM([m_id_M016]) m_id_M016
,RTRIM([name_qty_M016]) name_qty_M016
,RTRIM([m_id_M017]) m_id_M017
,RTRIM([name_qty_M017]) name_qty_M017
,RTRIM([m_id_M018]) m_id_M018
,RTRIM([name_qty_M018]) name_qty_M018
,RTRIM([m_id_M019]) m_id_M019
,RTRIM([name_qty_M019]) name_qty_M019
,RTRIM([name_qty_M019_1]) name_qty_M019_1
,RTRIM([m_id_M020]) m_id_M020
,RTRIM([name_qty_M020]) name_qty_M020
,RTRIM([m_id_M021]) m_id_M021
,RTRIM([name_qty_M021]) name_qty_M021
,RTRIM([name_qty_M021_1]) name_qty_M021_1
,RTRIM([m_id_M022]) m_id_M022
,RTRIM([name_qty_M022]) name_qty_M022
,RTRIM([m_id_M023]) m_id_M023
,RTRIM([name_qty_M023]) name_qty_M023
,RTRIM([m_id_M024]) m_id_M024
,RTRIM([name_qty_M024]) name_qty_M024
,RTRIM([m_id_M025]) m_id_M025
,RTRIM([name_qty_M025]) name_qty_M025
,RTRIM([m_id_M026]) m_id_M026
,RTRIM([name_qty_M026]) name_qty_M026
,RTRIM([m_id_M027]) m_id_M027
,RTRIM([name_qty_M027]) name_qty_M027
,RTRIM([m_id_M028]) m_id_M028
,RTRIM([name_qty_M028]) name_qty_M028
,RTRIM([m_id_M029]) m_id_M029
,RTRIM([name_qty_M029]) name_qty_M029
,RTRIM([m_id_M030]) m_id_M030
,RTRIM([name_qty_M030]) name_qty_M030
,RTRIM([m_id_M031]) m_id_M031
,RTRIM([name_qty_M031]) name_qty_M031
,RTRIM([m_id_M032]) m_id_M032
,RTRIM([name_qty_M032]) name_qty_M032
,RTRIM([m_id_M033]) m_id_M033
,RTRIM([name_qty_M033]) name_qty_M033
,RTRIM([m_id_M034]) m_id_M034
,RTRIM([name_qty_M034]) name_qty_M034
,RTRIM([m_id_M035]) m_id_M035
,RTRIM([name_qty_M035]) name_qty_M035
,RTRIM([m_id_M036]) m_id_M036
,RTRIM([name_qty_M036]) name_qty_M036
,RTRIM([m_id_M037]) m_id_M037
,RTRIM([name_qty_M037]) name_qty_M037
,RTRIM([name_qty_M037_1]) name_qty_M037_1
,RTRIM([m_id_M038]) m_id_M038
,RTRIM([name_qty_M038]) name_qty_M038
,RTRIM([m_id_M039]) m_id_M039
,RTRIM([name_qty_M039]) name_qty_M039
,RTRIM([name_qty_M039_1]) name_qty_M039_1
,RTRIM([m_id_M040]) m_id_M040
,RTRIM([name_qty_M040]) name_qty_M040
,RTRIM([m_id_M041]) m_id_M041
,RTRIM([name_qty_M041]) name_qty_M041
,RTRIM([m_id_M042]) m_id_M042
,RTRIM([name_qty_M042]) name_qty_M042
,RTRIM([name_qty_M042_1]) name_qty_M042_1
,RTRIM([m_id_M043]) m_id_M043
,RTRIM([name_qty_M043]) name_qty_M043
,RTRIM([m_id_M044]) m_id_M044
,RTRIM([name_qty_M044]) name_qty_M044
,RTRIM([m_id_M045]) m_id_M045
,RTRIM([name_qty_M045]) name_qty_M045
,RTRIM([m_id_M046]) m_id_M046
,RTRIM([name_qty_M046]) name_qty_M046
,RTRIM([m_id_M047]) m_id_M047
,RTRIM([name_qty_M047]) name_qty_M047
,RTRIM([m_id_M048]) m_id_M048
,RTRIM([name_qty_M048]) name_qty_M048
,RTRIM([name_qty_M048_1]) name_qty_M048_1
,RTRIM([m_id_M049]) m_id_M049
,RTRIM([name_qty_M049]) name_qty_M049
,RTRIM([m_id_M050]) m_id_M050
,RTRIM([name_qty_M050]) name_qty_M050
,RTRIM([m_id_M051]) m_id_M051
,RTRIM([name_qty_M051]) name_qty_M051
,RTRIM([m_id_M052]) m_id_M052
,RTRIM([name_qty_M052]) name_qty_M052
,RTRIM([m_id_M053]) m_id_M053
,RTRIM([name_qty_M053]) name_qty_M053
,RTRIM([m_id_M054]) m_id_M054
,RTRIM([name_qty_M054]) name_qty_M054
,RTRIM([m_id_M055]) m_id_M055
,RTRIM([name_qty_M055]) name_qty_M055
,RTRIM([m_id_M056]) m_id_M056
,RTRIM([name_qty_M056]) name_qty_M056
,RTRIM([m_id_M057]) m_id_M057
,RTRIM([name_qty_M057]) name_qty_M057
,RTRIM([m_id_M058]) m_id_M058
,RTRIM([name_qty_M058]) name_qty_M058
,RTRIM([m_id_M059]) m_id_M059
,RTRIM([name_qty_M059]) name_qty_M059
,RTRIM([m_id_M060]) m_id_M060
,RTRIM([name_qty_M060]) name_qty_M060
,RTRIM([m_id_M061]) m_id_M061
,RTRIM([name_qty_M061]) name_qty_M061
,RTRIM([m_id_M062]) m_id_M062
,RTRIM([name_qty_M062]) name_qty_M062
,RTRIM([m_id_M063]) m_id_M063
,RTRIM([name_qty_M063]) name_qty_M063
,RTRIM([m_id_M064]) m_id_M064
,RTRIM([name_qty_M064]) name_qty_M064
,RTRIM([m_id_M065]) m_id_M065
,RTRIM([name_qty_M065]) name_qty_M065
,RTRIM([m_id_M066]) m_id_M066
,RTRIM([name_qty_M066]) name_qty_M066
,RTRIM([m_id_M067]) m_id_M067
,RTRIM([name_qty_M067]) name_qty_M067
,RTRIM([m_id_M068]) m_id_M068
,RTRIM([name_qty_M068]) name_qty_M068
from temp_3 a left join c_material_type b on a.desp_0 = b.type_name
</select>
</mapper> </mapper>

View File

@ -60,3 +60,11 @@ export function listMaterialType(query) {
params: query params: query
}) })
} }
//同步物料材料用量
export function synchronizeUpdate() {
return request({
url: '/material/material/synchronizeUpdate',
method: 'post'
})
}

View File

@ -84,6 +84,16 @@
v-hasPermi="['material:material:export']" v-hasPermi="['material:material:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-refresh-right"
size="mini"
@click="handleSynchronize"
v-hasPermi="['material:material:synchronizeMaterialData']"
>同步物料材料用量</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@ -247,7 +257,7 @@
} }
</style> </style>
<script> <script>
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, listClMaterial, listMaterialType } from "@/api/material/material"; import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, listClMaterial, listMaterialType, synchronizeUpdate } from "@/api/material/material";
import log from "../../monitor/job/log"; import log from "../../monitor/job/log";
import { numAdd,numSub,numMulti,numDiv } from "@/utils/operation"; import { numAdd,numSub,numMulti,numDiv } from "@/utils/operation";
@ -550,6 +560,16 @@ export default {
selectClChange(row){ selectClChange(row){
row.materialPrice = this.cmaterialsmap[row.costClId]; row.materialPrice = this.cmaterialsmap[row.costClId];
this.sumPriceTotal() this.sumPriceTotal()
},
/*同步物料材料用量*/
handleSynchronize(){
this.$modal.confirm('是否确认同步更新?').then(function() {
return synchronizeUpdate();
}).then(() => {
this.getList();
this.$modal.msgSuccess("更新成功");
}).catch(() => {});
} }
} }
}; };