/**
  * Pda_makeAssignListAct::act_checkNum()
  * 检测输入的料号数量并提交
  * @return void
  */
 public function act_checkSkuNum()
 {
     $sku = trim($_POST['sku']);
     $sku = get_goodsSn($sku);
     $sku_num = intval(trim($_POST['sku_num']));
     if (!$sku_num || !$sku) {
         self::$errCode = '001';
         self::$errMsg = '信息不完整!';
         return FALSE;
     }
     if ($sku_num < 0) {
         self::$errCode = '002';
         self::$errMsg = '调拨数量不能小于0!';
         return FALSE;
     }
     $actualStock = whShelfModel::selectSkuNums($sku, 1);
     //获取A仓库的总库存
     if ($actualStock < $sku_num) {
         self::$errCode = '003';
         self::$errMsg = '调拨数量不能该料号的实际库存!';
         return FALSE;
     }
     $location = WhGoodsAssignModel::getSkuLocation($sku, 1, $sku_num);
     if (!$location) {
         self::$errCode = '004';
         self::$errMsg = '没有满足调拨数量的仓位!';
         return FALSE;
     }
     $res = WhGoodsAssignModel::getDetail('0', " and a.sku ='{$sku}'");
     //检测是否有未生成调拨单的该料号信息
     if (empty($res)) {
         $info = WhGoodsAssignModel::insertAssignDetail(0, $sku, $sku_num, $location);
         //插入调拨详情表
     } else {
         $nums = $res['num'] + $sku_num;
         //调拨数量总和
         $info = WhGoodsAssignModel::updateAssignDetail(array('id' => $res['id']), array('num' => $nums));
     }
     if ($info) {
         self::$errCode = '200';
         self::$errMsg = '请输入下一料号!';
         return TRUE;
     } else {
         self::$errCode = '005';
         self::$errMsg = '插入料号失败!';
         return FALSE;
     }
 }
 /**
  * WhGoodsAssignAct::buildDetails()
  * 格式化调拨明细表中的sku及数量 
  * @param array $sku
  * @param array $num
  * @param int $outStoreId
  * @param int $goodsAssignId
  * @return void
  */
 function buildDetails($sku, $num, $outStoreId, $goodsAssignId)
 {
     if (!is_array($sku) || !is_array($num) || !intval($outStoreId)) {
         return false;
     }
     $string = '';
     //$whGoods    =   new WhGoodsAssignModel();
     foreach ($sku as $k => $v) {
         $location = WhGoodsAssignModel::getSkuLocation($v, $outStoreId);
         //print_r($location);exit;
         $string .= "('{$goodsAssignId}', '{$v}', '{$num[$k]}', '{$location}'), ";
     }
     return trim($string, ', ');
 }