|
@@ -5,8 +5,17 @@ import com.iamberry.rst.core.order.RentType;
|
|
|
import com.iamberry.rst.core.page.PageRequest;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
import com.iamberry.rst.core.pts.*;
|
|
|
+import com.iamberry.rst.core.pts.PtsEmployee;
|
|
|
+import com.iamberry.rst.core.pts.ProduceProcess;
|
|
|
+import com.iamberry.rst.core.pts.PtsMachine;
|
|
|
+import com.iamberry.rst.core.pts.PtsMachineLogs;
|
|
|
+import com.iamberry.rst.core.pts.PtsMachineStatistics;
|
|
|
+import com.iamberry.rst.core.tools.QRCJson;
|
|
|
+import com.iamberry.rst.core.tools.WeixinUtil;
|
|
|
import com.iamberry.rst.faces.pts.*;
|
|
|
+import com.iamberry.wechat.tools.NameUtils;
|
|
|
import com.iamberry.wechat.tools.ResponseJson;
|
|
|
+import com.iamberry.wechat.tools.ResultInfo;
|
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
@@ -358,5 +367,74 @@ public class AdminMachineController {
|
|
|
}
|
|
|
return mm;
|
|
|
}
|
|
|
+
|
|
|
+ private String productNfcId = "1390730000";//默认nfcId
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 进入批量生产机器页面
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ * @author LJK
|
|
|
+ * @date 2017年8月31日16:08:15
|
|
|
+ */
|
|
|
+ @RequiresPermissions("machine:add:batch")
|
|
|
+ @RequestMapping("/_to_add_batch")
|
|
|
+ public ModelAndView toAddMachineBatch() {
|
|
|
+ ModelAndView mv = new ModelAndView("pts/machine/batchAddMachine");
|
|
|
+ List<Produce> list = produceService.getProduceList();
|
|
|
+ mv.addObject("produceList", list);
|
|
|
+ return mv;
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequiresPermissions("machine:add:batch")
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping("/_add_machine_batch")
|
|
|
+ public ResponseJson addMachineBatch(HttpServletRequest request) {
|
|
|
+ ResponseJson rj = new ResponseJson();
|
|
|
+ String machineType = request.getParameter("machineType");
|
|
|
+ String machineSoftwareVersion = request.getParameter("machineSoftwareVersion");
|
|
|
+ String number = request.getParameter("number");
|
|
|
+ if (machineType == null || machineType.equals("") ||
|
|
|
+ machineSoftwareVersion == null || machineSoftwareVersion.equals("") ||
|
|
|
+ number == null || number.equals("")) {
|
|
|
+ rj.setReturnCode(500);
|
|
|
+ return rj;
|
|
|
+ }
|
|
|
+
|
|
|
+ Produce produce = new Produce();
|
|
|
+ produce.setProduceId(Integer.valueOf(machineType));
|
|
|
+ produce = produceService.getProduce(produce); //根据产品获取产品信息
|
|
|
+
|
|
|
+ ArrayList<PtsMachine> ptsList = new ArrayList<PtsMachine>();
|
|
|
+ PtsMachine ptsMachine = new PtsMachine();
|
|
|
+ MachineController machineController = new MachineController();
|
|
|
+ for (int i = 0; i < Integer.valueOf(number); i++) {
|
|
|
+ //生成条形码,二维码
|
|
|
+ String berQrcode = machineController.generationBarCode(produce);
|
|
|
+ String json = String.format(NameUtils.QR_LIMIT_STR_SCENE, ResultInfo.barCodePrefix + berQrcode);
|
|
|
+ QRCJson qrc = WeixinUtil.createQrcode(json);
|
|
|
+ ptsMachine.setMachineQrcode(qrc.getUrl());//二维码
|
|
|
+ ptsMachine.setMachineBarcode(berQrcode);//条形码
|
|
|
+ ptsMachine.setMachineStatus(1);//机器状态
|
|
|
+ ptsMachine.setMachineProducedTime(new Date());//生产时间
|
|
|
+ ptsMachine.setMachineIsPrint(1);//是否打印1:未打印2:已打印
|
|
|
+ ptsMachine.setMachineCompoundImg("合成的图片url");
|
|
|
+ ptsMachine.setMachineProcessState(1);//生成流程状态1.正常2.异常
|
|
|
+ ptsMachine.setMachineCreateTime(new Date());//创建时间
|
|
|
+ ptsMachine.setMachineProduceType(Integer.valueOf(machineType));//产品类型
|
|
|
+ ptsMachine.setMachineNfcId(productNfcId);
|
|
|
+ ptsMachine.setMachineHardwareVersion(machineSoftwareVersion);
|
|
|
+ ptsMachine.setMachineSoftwareVersion(machineSoftwareVersion);
|
|
|
+ ptsList.add(ptsMachine);
|
|
|
+ }
|
|
|
+ Integer msg = machineService.addMahineBatch(ptsList);
|
|
|
+ if (msg > 0) {
|
|
|
+ rj.setReturnCode(200);
|
|
|
+ } else {
|
|
|
+ rj.setReturnCode(500);
|
|
|
+ }
|
|
|
+ return rj;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|