| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- package xin.glue.ui.G.G04;
- import java.math.BigDecimal;
- import java.util.HashMap;
- import java.util.Map;
- import xin.glue.ui.common.component.PosSiteLog;
- import com.posdata.glue.biz.activity.PosActivity;
- import com.posdata.glue.biz.constants.PosBizControlConstants;
- import com.posdata.glue.context.PosContext;
- import com.posdata.glue.dao.PosGenericDao;
- import com.posdata.glue.dao.vo.PosParameter;
- import com.posdata.glue.dao.vo.PosRow;
- import com.posdata.glue.dao.vo.PosRowSet;
- /*
- * ???陋?寧刻 C/R ????
- * 凜槨矜狼?????璂??,杰鹿菱?畇寧??
- * @author tangliang
- * @date 2008.11.03
- */
- public class CreateCrCommand extends PosActivity{
-
- private String currDate = null;
- private String R_SLAB_RT = null;
- private String R_HCR_CLF = null;
- private Number R_SLAB_WTH = null;
- private Number R_SLAB_LEN = null;
- private String R_ORD_NO = null;
- private String R_PRODNM_CD = null;
- private String R_STL_GRD = null;
-
- private String YD_SLAB_NO = null;
- private String YD_STL_GRD = null;
- private String YD_PRODNM_CD = null;
- private String YD_ORD_NO = null;
- private Number YD_SLAB_LEN = null;
- private Number YD_SLAB_WTH = null;
- private String YD_YARD_ADDR = null;
- private String YD_STORELAY = null;
- private String CrNo = null;
-
- public String runActivity(PosContext context)
- {
-
-
- String[] FROM_ADDR = (String[])context.get("FROM_ADDR");
- String[] SLAB_NO = (String[])context.get("SLAB_NO");
- String sEmpLoc = null;
- String sEmpClf = null;
- String sTrue = null;
- int SlabCnt = 0;
- SlabCnt = SLAB_NO.length;
-
- if ( SlabCnt > 0) {
- for ( int i = 0;i < 10; i++) {
-
- currDate = null;
- R_SLAB_RT = null;
- R_HCR_CLF = null;
- R_SLAB_WTH = null;
- R_SLAB_LEN = null;
- R_ORD_NO = null;
- R_PRODNM_CD = null;
- R_STL_GRD = null;
-
- YD_SLAB_NO = null;
- YD_STL_GRD = null;
- YD_PRODNM_CD = null;
- YD_ORD_NO = null;
- YD_SLAB_LEN = null;
- YD_SLAB_WTH = null;
- YD_YARD_ADDR = null;
- YD_STORELAY = null;
- CrNo = null;
-
- // 根据板坯号查询板坯参数信息
- PosParameter param0 = new PosParameter();
- param0.setWhereClauseParameter(0, SLAB_NO[i]);
- PosRowSet SLabComVO = getDao("mesdao").find("NIG020640_SLAB_COMM.select", param0);
-
- if(SLabComVO.hasNext()) {
- PosRow SLabComRow = SLabComVO.next();
-
- R_SLAB_RT = (String)SLabComRow.getAttribute("SLAB_WAY");
- R_HCR_CLF = (String)SLabComRow.getAttribute("HCR_CLF");
- R_SLAB_WTH = (Number)SLabComRow.getAttribute("SLAB_WTH");
- R_SLAB_LEN = (Number)SLabComRow.getAttribute("SLAB_LEN");
- R_ORD_NO = (String)SLabComRow.getAttribute("ORD_NO");
- R_PRODNM_CD = (String)SLabComRow.getAttribute("PRODNM_CD");
- R_STL_GRD = (String)SLabComRow.getAttribute("STL_GRD");
-
- // 查询对应板坯可以在热轧板坯库第一跨的堆放位置
- PosParameter param1 = new PosParameter();
- param1.setWhereClauseParameter(0, SLAB_NO[i]);
- PosRowSet maxStoVO = getDao("mesdao").find("NIG020640_STLGRD.select", param1);
- while(maxStoVO.hasNext()){
- PosRow maxStoROW = maxStoVO.next();
-
- String YARD_ADDR = (String)maxStoROW.getAttribute("YARD_ADDR");
- String YARD_COND_CLF = (String)maxStoROW.getAttribute("YARD_COND_CLF");
-
- PosParameter param2 = new PosParameter();
- param2.setWhereClauseParameter(0, YARD_ADDR);
- param2.setWhereClauseParameter(1, YARD_ADDR);
-
- // 查询一个跺位已经堆放的板坯中,最上面那块的板坯信息
- PosRowSet SlabYardVo = getDao("mesdao").find("NIG020640_SLAB_YARD.select", param2);
- if (SlabYardVo.hasNext()) {
- PosRow SlabYardROW = SlabYardVo.next();
- YD_SLAB_NO = (String)SlabYardROW.getAttribute("SLAB_NO");
- YD_STL_GRD = (String)SlabYardROW.getAttribute("STL_GRD");
- YD_PRODNM_CD = (String)SlabYardROW.getAttribute("PRODNM_CD");
- YD_ORD_NO = (String)SlabYardROW.getAttribute("ORD_NO");
- YD_SLAB_LEN = (Number)SlabYardROW.getAttribute("SLAB_LEN");
- YD_SLAB_WTH = (Number)SlabYardROW.getAttribute("SLAB_WTH");
- YD_YARD_ADDR = (String)SlabYardROW.getAttribute("YARD_ADDR");
- YD_STORELAY = (String)SlabYardROW.getAttribute("STORELAY");
-
- // 如果一个跺位的板坯堆放超过15块,因为最多只能堆放16块,则该跺位不能继续堆放
- int intYdStore = Integer.parseInt(YD_STORELAY);
- if (intYdStore > 15 ){
- break;
- }
-
- String sSel = compSlab(SLAB_NO[i],R_STL_GRD);
-
-
- if (sSel != null && sSel.equals("S")) {
- sTrue = CreCrComand( YD_YARD_ADDR,YD_STORELAY,YARD_COND_CLF);
-
- break;
- }
-
-
- } else {
- sEmpLoc = YARD_ADDR;
- sEmpClf = YARD_COND_CLF;
- }
-
- if (sTrue == null && sEmpLoc != null ) {
- sTrue = CreCrComand( sEmpLoc,"01",sEmpClf);
- String SlabWay = sEmpLoc.substring(0,2);
-
- }
- context.put("YARD_ADDR"+i,YARD_ADDR);
- context.put("CR_NO"+i,CrNo);
-
- }
- }
-
- }
- }
-
- return PosBizControlConstants.SUCCESS;
- }
- public String compSlab(String sSlabNo,String sStlGrd)
- {
- logger.logInfo("XinDecToPosition compSlab start " );
-
- double tol = 5;
-
- double D_R_SLAB_WTH = R_SLAB_WTH.doubleValue();
-
- logger.logInfo("XinDecToPosition compSlab D_R_SLAB_WTH:"+D_R_SLAB_WTH );
-
- double D_R_SLAB_LEN = R_SLAB_LEN.doubleValue();
-
- logger.logInfo("XinDecToPosition compSlab D_R_SLAB_LEN:"+D_R_SLAB_LEN );
-
- double D_YD_SLAB_LEN = YD_SLAB_LEN.doubleValue();
- double D_YD_SLAB_WTH = YD_SLAB_WTH.doubleValue();
-
- logger.logInfo("XinDecToPosition compSlab D_YD_SLAB_WTH:"+D_YD_SLAB_WTH );
-
-
- double rem_len = Math.abs(D_YD_SLAB_LEN - D_R_SLAB_LEN);
- double rem_wth = Math.abs(D_R_SLAB_WTH - D_YD_SLAB_WTH);
-
- logger.logInfo("XinDecToPosition compSlab rem_wth:"+rem_wth );
- logger.logInfo("XinDecToPosition compSlab rem_len:"+rem_len );
-
- String sRChargeNo = sSlabNo.substring(0,10);
- String sYChargeNo = YD_SLAB_NO.substring(0,10);
-
-
- logger.logInfo("XinDecToPosition compSlab sYChargeNo:"+sYChargeNo );
-
- Number aa = (Number) new Double(rem_len);
-
- if (rem_len > tol ) {
- logger.logInfo("XinDecToPosition compSlab rem_len> tol " );
- return "";
- }
- logger.logInfo("XinDecToPosition compSlab rem_len comp " );
-
- if (rem_wth > tol ) {
- return "";
- }
- //同订单,同牌号,同炉次的板坯可以放一起
- if ( R_ORD_NO.equals(YD_ORD_NO) && sStlGrd.equals(YD_STL_GRD) ) {
- return "S";
- }
- if ( R_ORD_NO.equals(YD_ORD_NO) ) {
- return "S";
- }
- if ( sStlGrd.equals(YD_STL_GRD) ) {
- return "S";
- }
- if ( sRChargeNo.equals(sYChargeNo) ) {
- return "S";
- }
- return "";
- }
-
- public String CreCrComand( String YardAddr,String Storelay,String YardClf)
- {
- logger.logInfo("XinDecToPosition--->CreCrComand: start" );
-
- String nOrdSeq = null;
- int iSeq = 0;
-
-
- PosRowSet YardCommandVo = getDao("mesdao").find("NIG020640_YARD_COMMAND.select", null);
- if ( YardCommandVo.hasNext() ) {
- PosRow YardCommandROW = YardCommandVo.next();
- nOrdSeq = (String)YardCommandROW.getAttribute("ORD_SEQ");
- iSeq = Integer.parseInt(nOrdSeq);
- iSeq = iSeq + 1;
- } else {
- iSeq = 1 ;
- }
-
-
- String Areas = YardAddr.substring(2,3);
-
- if (Areas.equals("1")) {
- CrNo = "1-2";
- } else {
- CrNo = "1-1";
- }
- logger.logInfo("XinDecToPosition--->CrNo:"+ CrNo );
-
- String sSeqNo = String.valueOf(iSeq);
-
- PosParameter param1 = new PosParameter();
- param1.setValueParamter(0, sSeqNo);
- param1.setValueParamter(1, YardClf);
- param1.setValueParamter(2, Storelay);
- param1.setValueParamter(3, CrNo);
- param1.setValueParamter(4, YardAddr);
- param1.setValueParamter(5, YardClf);
-
- getDao("mesdao").update("NIG020640_YARD_COMMAND.insert",param1);
-
-
- return "t";
- }
- }
|