Ejemplo n.º 1
0
 public function view_tmpModReturnPros()
 {
     //添加sku
     $type = isset($_GET['type']) ? $_GET['type'] : '';
     $sku = isset($_GET['sku']) ? post_check(trim($_GET['sku'])) : '';
     $addUserId = intval($_SESSION['userId']);
     if ($addUserId <= 0) {
         $status = '登陆超时,请重试';
         header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
         exit;
     }
     $now = time();
     if ($type == 'add') {
         if (!empty($sku)) {
             $skuList = getSkuBygoodsCode($sku);
             $sku = $skuList[0]['sku'];
             if (empty($sku)) {
                 $status = "{$_GET['sku']} 找不到对应料号";
                 header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
                 exit;
             }
             $tName = 'pc_products_iostore_detail';
             $where = "WHERE is_delete=0 AND sku='{$sku}' AND iostoreTypeId=1 AND useTypeId=2 AND isAudit<3";
             //找出领料单中修改领取的该产品记录数
             $countDetailLL = OmAvailableModel::getTNameCount($tName, $where);
             if (empty($countDetailLL)) {
                 $status = "找不到 {$_GET['sku']} 的 修改领料 记录";
                 header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
                 exit;
             }
             $tName = 'pc_products_iostore_detail';
             $where = "WHERE is_delete=0 AND sku='{$sku}' AND iostoreTypeId=2 AND useTypeId=2 AND isAudit<3";
             //找出退料单中修改归还的该产品记录数
             $countDetailTL = OmAvailableModel::getTNameCount($tName, $where);
             $allowAddCount = $countDetailLL - $countDetailTL;
             //该料号允许添加的数量
             $tName = 'pc_tmp_products_return';
             $where = "WHERE returnType=3 AND sku='{$sku}'";
             $countSku = OmAvailableModel::getTNameCount($tName, $where);
             $countSku++;
             //当前该sku的数量
             if ($allowAddCount < $countSku) {
                 //如果允许添加的该sku数量小于该sku已经添加的数量,则报错
                 $status = "{$_GET['sku']} 已经全部归还,不能再添加";
                 header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
                 exit;
             }
             $set = "SET returnType=3,sku='{$sku}',addUserId='{$addUserId}',createdTime='{$now}'";
             //type=3 ,修改归还
             OmAvailableModel::addTNameRow($tName, $set);
             $status = $sku . ' 添加成功';
             header('Location:index.php?mod=products&act=tmpModReturnPros&status=' . $status);
         }
     }
     //展示tmp表中的记录
     $tName = 'pc_tmp_products_return';
     $select = "*";
     $where = "WHERE returnType=3 order by createdTime desc";
     //修改领料
     $tmpModReturnProsList = OmAvailableModel::getTNameList($tName, $select, $where);
     $navlist = array(array('url' => 'index.php?mod=products&act=getProductsComfirmList', 'title' => '产品制作'), array('url' => 'index.php?mod=products&act=tmpModReturnPros', 'title' => '修改产品归还'));
     $this->smarty->assign('navlist', $navlist);
     $this->smarty->assign('onevar', 5);
     $this->smarty->assign('twovar', 510);
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('title', '修改产品归还');
     if (!empty($tmpModReturnProsList)) {
         $whInfoList = getWhInfo();
         //根据接口取得对应仓库信息
         $whArr = array();
         foreach ($whInfoList as $value) {
             if (intval($value['id']) > 0) {
                 $whArr[$value['id']] = $value['whName'];
             }
         }
         $countProsList = count($tmpModReturnProsList);
         for ($i = 0; $i < $countProsList; $i++) {
             $sku = $tmpModReturnProsList[$i]['sku'];
             $tName = 'pc_goods';
             $select = 'goodsName';
             $where = "WHERE sku='{$sku}'";
             $skuInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
             $tmpModReturnProsList[$i]['goodsName'] = $skuInfoList[0]['goodsName'];
             $tName = 'pc_goods_whId_location_raletion';
             $select = 'location,whId';
             $where = "WHERE sku='{$sku}'";
             $skuLocWhInfoList = OmAvailableModel::getTNameList($tName, $select, $where);
             $tmpModReturnProsList[$i]['location'] = $skuLocWhInfoList[0]['location'];
             $tmpModReturnProsList[$i]['whName'] = $whArr[$skuLocWhInfoList[0]['whId']];
         }
     }
     $this->smarty->assign('tmpModReturnProsList', empty($tmpModReturnProsList) ? array() : $tmpModReturnProsList);
     $this->smarty->display("tmpModReturnPros.htm");
 }
Ejemplo n.º 2
0
 /**
  *功能:提供给仓库系统的接口,重量拦截重新得到重量
  * */
 public function act_setSkuWeightInWh()
 {
     $sku = isset($_GET['sku']) ? $_GET['sku'] : "";
     $skuweight = isset($_GET['skuweight']) ? $_GET['skuweight'] / 1000 : "";
     //传递过来的重量为g
     $userId = isset($_GET['userId']) ? $_GET['userId'] : 0;
     if (intval($userId) <= 0) {
         self::$errCode = 111;
         self::$errMsg = "登陆超时,请重新登陆!";
         return false;
     }
     if (empty($sku) || empty($skuweight)) {
         self::$errCode = 333;
         self::$errMsg = "料号或重量不能为空!";
         return false;
     }
     $skuList = getSkuBygoodsCode($sku);
     //根据条码获取真实sku
     if (empty($skuList)) {
         self::$errCode = 404;
         self::$errMsg = '料号不存在';
         return false;
     }
     $oldWeight = !empty($skuList[0]['goodsWeight']) ? $skuList[0]['goodsWeight'] : 0;
     //先找出该sku的重量
     if ($oldWeight != $skuweight) {
         //如果新旧重量不相等时,则更新
         try {
             BaseModel::begin();
             $tName = 'pc_goods';
             $set = "SET goodsWeight='{$skuweight}'";
             $where = "WHERE sku='{$skuList[0]['sku']}'";
             OmAvailableModel::updateTNameRow($tName, $set, $where);
             //$info = UserCacheModel::getOpenSysApi('pc.updateTNameRow',array(array('tName'=>"pc_goods",'set'=>"goodsWeight='{$skuweight}'",'where'=>"WHERE sku='{$sku}' and is_delete = 0")));
             //添加重量备份记录
             //$tName = 'pc_goods_weight_backups';
             //    			$backupsArr = array ();
             //    			$backupsArr['sku'] = $skuList[0]['sku'];
             //    			$backupsArr['goodsWeight'] = $skuweight;
             //    			$backupsArr['addUserId'] = $userId;
             //    			$backupsArr['addTime'] = time();
             //    			OmAvailableModel :: addTNameRow2arr($tName, $backupsArr);
             addWeightBackupsModify($skuList[0]['sku'], $skuweight, $userId);
             //
             //$url = "add2ebay_goods_weight.php?goods_sn=".$skuList[0]['sku']."&goods_weight=".$skuweight;
             //            OmAvailableModel::newData2ErpInterf($url);
             $paraArr['goods_sn'] = $skuList[0]['sku'];
             $paraArr['goods_weight'] = $skuweight;
             $res = OmAvailableModel::newData2ErpInterfOpen('pc.erp.addGoodsSnWeight', $paraArr, 'gw88');
             //print_r($res);
             //            exit;
             BaseModel::commit();
             BaseModel::autoCommit();
             $string = empty($oldWeight) ? "(Kg) 录入成功!" : "(Kg) 更新成功,原来重量为 {$oldWeight}(Kg)";
             self::$errCode = 200;
             self::$errMsg = $skuList[0]['sku'] . " 重量 " . $skuweight . $string;
             return true;
         } catch (Exception $e) {
             BaseModel::rollback();
             BaseModel::autoCommit();
             self::$errCode = 404;
             self::$errMsg = $skuList[0]['sku'] . " 重量 " . $skuweight . "(Kg) 录入失败! " . $e->getMessage();
             return false;
         }
     } else {
         self::$errCode = 200;
         self::$errMsg = $skuList[0]['sku'] . " 重量 无修改,为 {$skuweight}(Kg)";
         return true;
     }
 }
Ejemplo n.º 3
0
 function act_addSkuVolume()
 {
     $goodsCode = post_check($_POST['goodsCode']);
     $goodsLength = trim($_POST['goodsLength']);
     $goodsWidth = trim($_POST['goodsWidth']);
     $goodsHeight = trim($_POST['goodsHeight']);
     if (intval($goodsCode) == 0) {
         return false;
     }
     if (is_numeric($goodsLength) <= 0 || is_numeric($goodsLength) > 9999) {
         return false;
     }
     if (is_numeric($goodsWidth) <= 0 || is_numeric($goodsWidth) > 9999) {
         return false;
     }
     if (is_numeric($goodsHeight) <= 0 || is_numeric($goodsHeight) > 9999) {
         return false;
     }
     $skuList = getSkuBygoodsCode($goodsCode);
     if (empty($skuList)) {
         return false;
     }
     $tName = 'pc_goods';
     $set = "SET goodsLength={$goodsLength},goodsWidth={$goodsWidth},goodsHeight={$goodsHeight}";
     $where = "WHERE spu='{$skuList[0]['spu']}'";
     $affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
     if ($affectRow === false) {
         return false;
     }
     $skuList = OmAvailableModel::getTNameList($tName, 'sku,spu', "WHERE spu='{$skuList[0]['spu']}'");
     return array('state' => 200, 'sku' => $skuList[0]['sku'] . ' 等 ' . count($skuList) . ' 个料号');
 }