|
@@ -30,7 +30,7 @@ void AutoPackForm::init()
|
|
|
connect(&packConfig,&RemotePackConfig::dengJIConfigUp,this,&AutoPackForm::upDengjiInfo);
|
|
connect(&packConfig,&RemotePackConfig::dengJIConfigUp,this,&AutoPackForm::upDengjiInfo);
|
|
|
connect(&_request,&HttpRequest::result,this,&AutoPackForm::httpResult);
|
|
connect(&_request,&HttpRequest::result,this,&AutoPackForm::httpResult);
|
|
|
ui->comboBox->clear();
|
|
ui->comboBox->clear();
|
|
|
- for(int i = 0;i<20;i++){
|
|
|
|
|
|
|
+ for(int i = 1;i<20;i++){
|
|
|
ui->comboBox->addItem(QString::number(i));
|
|
ui->comboBox->addItem(QString::number(i));
|
|
|
}
|
|
}
|
|
|
on_addPackList_clicked();
|
|
on_addPackList_clicked();
|
|
@@ -106,10 +106,13 @@ void AutoPackForm::on_pushStart_clicked()
|
|
|
void AutoPackForm::doSend(QSharedPointer<PackInfo> &info)
|
|
void AutoPackForm::doSend(QSharedPointer<PackInfo> &info)
|
|
|
{
|
|
{
|
|
|
if(info.isNull()) return;
|
|
if(info.isNull()) return;
|
|
|
|
|
+ //把数据添加到数据库里
|
|
|
|
|
+ insertProductSQL(info);
|
|
|
//TODO:发送码单 packinfo 数据, 转换为 json数据发送
|
|
//TODO:发送码单 packinfo 数据, 转换为 json数据发送
|
|
|
QJsonObject json = this->toJson(info);
|
|
QJsonObject json = this->toJson(info);
|
|
|
_request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
|
|
_request.setUserToken(QString::number(GlobalInfo::this_()->user().accountId),GlobalInfo::this_()->user().acessToken);
|
|
|
// _request.post("http://doc.vanlai.net:3001/web/#/1?page_id=64",json);
|
|
// _request.post("http://doc.vanlai.net:3001/web/#/1?page_id=64",json);
|
|
|
|
|
+
|
|
|
} // http://doc.vanlai.net:3001/web/#/1?page_id=64
|
|
} // http://doc.vanlai.net:3001/web/#/1?page_id=64
|
|
|
|
|
|
|
|
void AutoPackForm::on_addBoxList_clicked()
|
|
void AutoPackForm::on_addBoxList_clicked()
|
|
@@ -122,19 +125,35 @@ void AutoPackForm::on_addBoxList_clicked()
|
|
|
box->bucket_weight = ui->pizhong->currentText().toInt()*ui->tongshu->text().toInt();
|
|
box->bucket_weight = ui->pizhong->currentText().toInt()*ui->tongshu->text().toInt();
|
|
|
box->gross_weight = ui->grossWeight_2->text().toInt();
|
|
box->gross_weight = ui->grossWeight_2->text().toInt();
|
|
|
box->box_weight = ui->netWeight_2->text().toInt();
|
|
box->box_weight = ui->netWeight_2->text().toInt();
|
|
|
|
|
+ box->sort = "1";
|
|
|
box->remark = ui->beizhu->toPlainText();
|
|
box->remark = ui->beizhu->toPlainText();
|
|
|
packinfo->level = ui->dengji->currentText();
|
|
packinfo->level = ui->dengji->currentText();
|
|
|
packinfo->level_id = ui->dengji->currentData().toInt();
|
|
packinfo->level_id = ui->dengji->currentData().toInt();
|
|
|
- packinfo->addBoxInfoList(box);
|
|
|
|
|
- insertDetailsSQL(box,packinfo->codeSingle());
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
//TODO: 缓存数据,显示数据
|
|
//TODO: 缓存数据,显示数据
|
|
|
// emit djmbbox(djmb.printBoxInfo(box->caseNumber(),box));
|
|
// emit djmbbox(djmb.printBoxInfo(box->caseNumber(),box));
|
|
|
// qDebug()<<packinfo->boxes().size();
|
|
// qDebug()<<packinfo->boxes().size();
|
|
|
// doSend(packinfo);
|
|
// doSend(packinfo);
|
|
|
|
|
|
|
|
|
|
+ //把box数据添加到packinfo的boxes数据表里;
|
|
|
|
|
+ packinfo->addBoxInfoList(box);
|
|
|
|
|
+
|
|
|
|
|
+ //添加数据库
|
|
|
|
|
+ insertDetailsSQL(box,packinfo->codeSingle());
|
|
|
|
|
+
|
|
|
|
|
+ //packinfo其他数据在new时已经定义好的,需要时直接调就可以了,所以这里只要箱数,等级,机台和类型
|
|
|
|
|
+ if(packinfo->boxes().size()>=ui->comboBox->currentText().toInt()){
|
|
|
|
|
+ packinfo->quantity = packinfo->boxes().size();
|
|
|
|
|
+ packinfo->level_id = ui->dengji->currentData().toInt();
|
|
|
|
|
+ packinfo->machine_no = ui->jitai->currentText();
|
|
|
|
|
+ packinfo->carton_type = ui->zhixiang->currentText();
|
|
|
|
|
+ on_addPackList_clicked();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
void AutoPackForm::httpResult(int emitcode, const QJsonObject body)
|
|
void AutoPackForm::httpResult(int emitcode, const QJsonObject body)
|
|
|
{
|
|
{
|
|
|
qDebug()<<emitcode;
|
|
qDebug()<<emitcode;
|
|
@@ -142,8 +161,11 @@ void AutoPackForm::httpResult(int emitcode, const QJsonObject body)
|
|
|
database.changeState(packinfo->codeSingle());
|
|
database.changeState(packinfo->codeSingle());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+//把BoxInfo数据添加到deetails数据库里;
|
|
|
void AutoPackForm::insertDetailsSQL(QSharedPointer<BoxInfo> boxes,QString codeSingle)
|
|
void AutoPackForm::insertDetailsSQL(QSharedPointer<BoxInfo> boxes,QString codeSingle)
|
|
|
{
|
|
{
|
|
|
|
|
+ qDebug()<<boxes->caseNumber();
|
|
|
detailsData.code_single = codeSingle;
|
|
detailsData.code_single = codeSingle;
|
|
|
detailsData.case_number = boxes->caseNumber();
|
|
detailsData.case_number = boxes->caseNumber();
|
|
|
detailsData.box_weight = boxes->box_weight;
|
|
detailsData.box_weight = boxes->box_weight;
|
|
@@ -155,33 +177,34 @@ void AutoPackForm::insertDetailsSQL(QSharedPointer<BoxInfo> boxes,QString codeSi
|
|
|
detailsData.remark = boxes->remark;
|
|
detailsData.remark = boxes->remark;
|
|
|
|
|
|
|
|
if(database.insertDetails(detailsData)){
|
|
if(database.insertDetails(detailsData)){
|
|
|
- qDebug()<<"数据库添加失败";
|
|
|
|
|
|
|
+ qDebug()<<"details数据库添加成功";
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- qDebug()<<"数据库添加成功";
|
|
|
|
|
|
|
+ qDebug()<<"details数据库添加失败";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//把PackInfo添加到product数据库里;
|
|
|
void AutoPackForm::insertProductSQL(QSharedPointer<PackInfo> packes)
|
|
void AutoPackForm::insertProductSQL(QSharedPointer<PackInfo> packes)
|
|
|
{
|
|
{
|
|
|
- productData.goods_id = _info.goods_id;
|
|
|
|
|
|
|
+ productData.goods_id = packes->goodsID();
|
|
|
productData.code_single = packes->codeSingle();
|
|
productData.code_single = packes->codeSingle();
|
|
|
productData.quantity = packes->quantity;
|
|
productData.quantity = packes->quantity;
|
|
|
productData.level_id = packes->level_id;
|
|
productData.level_id = packes->level_id;
|
|
|
productData.tube_number = packes->tube_number();
|
|
productData.tube_number = packes->tube_number();
|
|
|
productData.gross_weight = packes->gross_weight();
|
|
productData.gross_weight = packes->gross_weight();
|
|
|
productData.net_weight = packes->net_weight();
|
|
productData.net_weight = packes->net_weight();
|
|
|
- productData.machine_no = QString::number(packes->machine_no);
|
|
|
|
|
- productData.packing_time = QString::number(packes->packing_time);
|
|
|
|
|
- productData.packing_type = QString::number(packes->packing_type);
|
|
|
|
|
|
|
+ productData.machine_no = packes->machine_no;
|
|
|
|
|
+ productData.packing_time = packes->packing_time;
|
|
|
|
|
+ productData.packing_type = packes->packing_type;
|
|
|
productData.carton_type = packes->carton_type;
|
|
productData.carton_type = packes->carton_type;
|
|
|
productData.operator_id = packes->operator_id;
|
|
productData.operator_id = packes->operator_id;
|
|
|
productData.remark = packes->remark;
|
|
productData.remark = packes->remark;
|
|
|
|
|
|
|
|
if(database.insertProduct(productData)){
|
|
if(database.insertProduct(productData)){
|
|
|
- qDebug()<<"数据库添加失败";
|
|
|
|
|
|
|
+ qDebug()<<"product数据库添加成功";
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- qDebug()<<"数据库添加失败";
|
|
|
|
|
|
|
+ qDebug()<<"product数据库添加失败";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -204,7 +227,7 @@ QJsonObject AutoPackForm::toJson(QSharedPointer<PackInfo> &info)
|
|
|
// detailsjson.insert("remark",info->boxes().at(i)->remark);
|
|
// detailsjson.insert("remark",info->boxes().at(i)->remark);
|
|
|
// jsonarray.append(detailsjson);
|
|
// jsonarray.append(detailsjson);
|
|
|
// }
|
|
// }
|
|
|
-// json.insert("goods_id",_info.goods_id);
|
|
|
|
|
|
|
+// json.insert("goods_id",packes->goodsID());
|
|
|
// json.insert("code_single",info->codeSingle());
|
|
// json.insert("code_single",info->codeSingle());
|
|
|
// json.insert("quantity",info->quantity);
|
|
// json.insert("quantity",info->quantity);
|
|
|
// json.insert("level_id",info->level_id);
|
|
// json.insert("level_id",info->level_id);
|