| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- package UIM;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import UIB.COM.XmlSqlParsersFactory;
- import CoreFS.SA01.CoreIComponent;
- import CoreFS.SA06.CoreReturnObject;
- /**
- * 冷轧中间库库存数据移动
- *
- * @author siy
- * @date 2010-08-27
- */
- public class UIM010181 extends CoreIComponent {
- /**
- * 查询钢卷位置
- *
- * @param coilNo
- * 冷轧卷号
- * @return CoreReturnObject
- * @throws SQLException
- */
- public CoreReturnObject queryLoadLoc(String coilNo) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- String sql = XmlSqlParsersFactory.getSql("UIM010181_02.SELECT");
- List list = this.getDao("KgDao").ExcuteQueryReturnList(sql,
- new Object[] { coilNo });// .ExcuteQuery(sql);
- String curLoadLoc = "";
- Iterator it = list.iterator();
- while (it.hasNext()) {
- Map map = (Map) it.next();
- curLoadLoc = map.get("cur_load_loc").toString();
- }
- // System.out.println(count);
- cro.setResult(curLoadLoc);
- return cro;
- }
- public CoreReturnObject queryYardAreas() throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- String sql = XmlSqlParsersFactory.getSql("UIM010181_01.SELECT");
- cro = this.getDao("KgDao").ExcuteQuery(sql);
- return cro;
- }
- /**
- * 查询区域中的垛位及钢卷
- *
- * @param areaName
- * @return
- * @throws SQLException
- */
- public CoreReturnObject queryYardCoils(String areaName) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- String[] rowBetween = areaName.split("-");
- if (rowBetween.length > 1) {
- String sql = XmlSqlParsersFactory.getSql("UIM010181_03.SELECT");
- cro = this.getDao("KgDao").ExcuteQuery(sql,
- new Object[] { rowBetween[0], rowBetween[1] });
- }
- return cro;
- }
- /**
- * 钢卷移垛
- *
- * @param moveList
- * 移垛钢卷垛位信息
- * @param regId
- * 移垛人
- * @param moveOrder
- * 移垛班次
- * @param moveGroup
- * 移垛班组
- * @param moveDate
- * 移垛时间
- * @return
- * @throws SQLException
- */
- public CoreReturnObject moveColdCoil(ArrayList<String[]> moveList,
- String regId, String moveOrder, String moveGroup, String moveDate)
- throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- StringBuffer sqlBuffer = null;
- Map result = this.getDao("KgDao").CoreBeginTranscation();
- try {
- for (int i = 0; i < moveList.size(); i++) {
- String[] moveCoil = moveList.get(i);
- // 更新钢卷公共表
- sqlBuffer = new StringBuffer();
- sqlBuffer.append(XmlSqlParsersFactory
- .getSql("UIM010181_01.UPDATE"));
- this.getDao("KgDao").ExcuteNonQuery(sqlBuffer.toString(),
- new Object[] { moveCoil[1], moveCoil[2] });
- // 更新垛位表
- sqlBuffer = new StringBuffer();
- sqlBuffer.append(XmlSqlParsersFactory
- .getSql("UIM010181_02.UPDATE"));
- this.getDao("KgDao").ExcuteNonQuery(
- sqlBuffer.toString(),
- new Object[] { "", regId, moveCoil[0], moveCoil[0],
- moveCoil[0], moveCoil[0] });
- this.getDao("KgDao").ExcuteNonQuery(
- sqlBuffer.toString(),
- new Object[] { moveCoil[2], regId, moveCoil[1],
- moveCoil[1], moveCoil[1], moveCoil[1] });
- // 移垛完成后将移垛记录加入移垛记录表,便于跟踪钢卷移动记录
- sqlBuffer = new StringBuffer();
- sqlBuffer.append(XmlSqlParsersFactory
- .getSql("UIM010181_01.INSERT"));
- this.getDao("KgDao").ExcuteNonQuery(
- sqlBuffer.toString(),
- new Object[] { moveCoil[0], moveCoil[1], moveCoil[2],
- regId, moveOrder, moveGroup, moveDate });
- }
- this.getDao("KgDao").CoreCommit(result);
- } catch (Exception e) {
- e.printStackTrace();
- this.getDao("KgDao").CoreRollBack(result);
- }
- return cro;
- }
- /**
- * 查询空余垛位
- *
- * @param areaName
- * @return
- * @throws SQLException
- */
- public CoreReturnObject queryEmptyYards(String areaName)
- throws SQLException {
- CoreReturnObject cro = null;
- String[] rowBetween = null;
- if (areaName != null && !areaName.equals("")) {
- rowBetween = areaName.split("-");
- }
- String sql = "";
- if (rowBetween != null && rowBetween.length > 1) {
- sql = XmlSqlParsersFactory.getSql("UIM010181_06.SELECT");
- cro = this.getDao("KgDao").ExcuteQuery(sql,
- new Object[] { rowBetween[0], rowBetween[1] });
- } else {
- sql = XmlSqlParsersFactory.getSql("UIM010181_05.SELECT");
- cro = this.getDao("KgDao").ExcuteQuery(sql);
- }
- return cro;
- }
- }
|